##// END OF EJS Templates
fixes issue #385 clone by ID url was loosing proxy prefix in URL
marcink -
r2099:e829e844 beta
parent child Browse files
Show More
@@ -26,6 +26,7 b''
26 26 import traceback
27 27 import calendar
28 28 import logging
29 import urllib
29 30 from time import mktime
30 31 from datetime import timedelta, date
31 32 from urlparse import urlparse
@@ -40,7 +41,7 b' from pylons.i18n.translation import _'
40 41 from beaker.cache import cache_region, region_invalidate
41 42
42 43 from rhodecode.model.db import Statistics, CacheInvalidation
43 from rhodecode.lib import ALL_READMES, ALL_EXTS
44 from rhodecode.lib import ALL_READMES, ALL_EXTS, safe_unicode
44 45 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
45 46 from rhodecode.lib.base import BaseRepoController, render
46 47 from rhodecode.lib.utils import EmptyChangeset
@@ -91,34 +92,37 b' class SummaryController(BaseRepoControll'
91 92
92 93 uri_tmpl = config.get('clone_uri', default_clone_uri)
93 94 uri_tmpl = uri_tmpl.replace('{', '%(').replace('}', ')s')
94
95 decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
95 96 uri_dict = {
96 97 'user': username,
97 98 'pass': password,
98 99 'scheme': parsed_url.scheme,
99 100 'netloc': parsed_url.netloc,
100 'path': parsed_url.path
101 'path': decoded_path
101 102 }
103
102 104 uri = uri_tmpl % uri_dict
103 105 # generate another clone url by id
104 uri_dict.update({'path': '/_%s' % c.dbrepo.repo_id})
106 uri_dict.update(
107 {'path': decoded_path.replace(repo_name, '_%s' % c.dbrepo.repo_id)}
108 )
105 109 uri_id = uri_tmpl % uri_dict
106 110
107 111 c.clone_repo_url = uri
108 112 c.clone_repo_url_id = uri_id
109 113 c.repo_tags = OrderedDict()
110 for name, hash in c.rhodecode_repo.tags.items()[:10]:
114 for name, hash_ in c.rhodecode_repo.tags.items()[:10]:
111 115 try:
112 c.repo_tags[name] = c.rhodecode_repo.get_changeset(hash)
116 c.repo_tags[name] = c.rhodecode_repo.get_changeset(hash_)
113 117 except ChangesetError:
114 c.repo_tags[name] = EmptyChangeset(hash)
118 c.repo_tags[name] = EmptyChangeset(hash_)
115 119
116 120 c.repo_branches = OrderedDict()
117 for name, hash in c.rhodecode_repo.branches.items()[:10]:
121 for name, hash_ in c.rhodecode_repo.branches.items()[:10]:
118 122 try:
119 c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash)
123 c.repo_branches[name] = c.rhodecode_repo.get_changeset(hash_)
120 124 except ChangesetError:
121 c.repo_branches[name] = EmptyChangeset(hash)
125 c.repo_branches[name] = EmptyChangeset(hash_)
122 126
123 127 td = date.today() + timedelta(days=1)
124 128 td_1m = td - timedelta(days=calendar.mdays[td.month])
General Comments 0
You need to be logged in to leave comments. Login now