Show More
@@ -20,8 +20,8 b' def make_map(config):' | |||
|
20 | 20 | rmap.minimization = False |
|
21 | 21 | rmap.explicit = False |
|
22 | 22 | |
|
23 |
from rhodecode.lib.utils import |
|
|
24 |
from rhodecode.lib.utils import |
|
|
23 | from rhodecode.lib.utils import is_valid_repo | |
|
24 | from rhodecode.lib.utils import is_valid_repos_group | |
|
25 | 25 | |
|
26 | 26 | def check_repo(environ, match_dict): |
|
27 | 27 | """ |
@@ -32,7 +32,7 b' def make_map(config):' | |||
|
32 | 32 | """ |
|
33 | 33 | |
|
34 | 34 | repo_name = match_dict.get('repo_name') |
|
35 |
return |
|
|
35 | return is_valid_repo(repo_name, config['base_path']) | |
|
36 | 36 | |
|
37 | 37 | def check_group(environ, match_dict): |
|
38 | 38 | """ |
@@ -43,7 +43,7 b' def make_map(config):' | |||
|
43 | 43 | """ |
|
44 | 44 | repos_group_name = match_dict.get('group_name') |
|
45 | 45 | |
|
46 |
return |
|
|
46 | return is_valid_repos_group(repos_group_name, config['base_path']) | |
|
47 | 47 | |
|
48 | 48 | |
|
49 | 49 | def check_int(environ, match_dict): |
@@ -71,7 +71,7 b' from paste.httpheaders import REMOTE_USE' | |||
|
71 | 71 | |
|
72 | 72 | from rhodecode.lib import safe_str |
|
73 | 73 | from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware |
|
74 |
from rhodecode.lib.utils import invalidate_cache, |
|
|
74 | from rhodecode.lib.utils import invalidate_cache, is_valid_repo | |
|
75 | 75 | from rhodecode.model.db import User |
|
76 | 76 | |
|
77 | 77 | from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError |
@@ -192,7 +192,7 b' class SimpleGit(object):' | |||
|
192 | 192 | log.debug('Repository path is %s' % repo_path) |
|
193 | 193 | |
|
194 | 194 | # quick check if that dir exists... |
|
195 |
if |
|
|
195 | if is_valid_repo(repo_name, self.basepath) is False: | |
|
196 | 196 | return HTTPNotFound()(environ, start_response) |
|
197 | 197 | |
|
198 | 198 | try: |
@@ -37,7 +37,7 b' from paste.httpheaders import REMOTE_USE' | |||
|
37 | 37 | from rhodecode.lib import safe_str |
|
38 | 38 | from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware |
|
39 | 39 | from rhodecode.lib.utils import make_ui, invalidate_cache, \ |
|
40 |
|
|
|
40 | is_valid_repo, ui_sections | |
|
41 | 41 | from rhodecode.model.db import User |
|
42 | 42 | |
|
43 | 43 | from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError |
@@ -161,7 +161,7 b' class SimpleHg(object):' | |||
|
161 | 161 | |
|
162 | 162 | |
|
163 | 163 | # quick check if that dir exists... |
|
164 |
if |
|
|
164 | if is_valid_repo(repo_name, self.basepath) is False: | |
|
165 | 165 | return HTTPNotFound()(environ, start_response) |
|
166 | 166 | |
|
167 | 167 | try: |
@@ -180,7 +180,7 b' def get_repos(path, recursive=False):' | |||
|
180 | 180 | return _get_repos(path) |
|
181 | 181 | |
|
182 | 182 | |
|
183 |
def |
|
|
183 | def is_valid_repo(repo_name, base_path): | |
|
184 | 184 | """ |
|
185 | 185 | Returns True if given path is a valid repository False otherwise |
|
186 | 186 | :param repo_name: |
@@ -196,7 +196,7 b' def check_repo_fast(repo_name, base_path' | |||
|
196 | 196 | except VCSError: |
|
197 | 197 | return False |
|
198 | 198 | |
|
199 |
def |
|
|
199 | def is_valid_repos_group(repos_group_name, base_path): | |
|
200 | 200 | """ |
|
201 | 201 | Returns True if given path is a repos group False otherwise |
|
202 | 202 | |
@@ -206,7 +206,7 b' def check_repos_group_fast(repos_group_n' | |||
|
206 | 206 | full_path = os.path.join(base_path, repos_group_name) |
|
207 | 207 | |
|
208 | 208 | # check if it's not a repo |
|
209 |
if |
|
|
209 | if is_valid_repo(repos_group_name, base_path): | |
|
210 | 210 | return False |
|
211 | 211 | |
|
212 | 212 | # check if it's a valid path |
@@ -301,7 +301,7 b' class RepoModel(BaseModel):' | |||
|
301 | 301 | :param parent_id: |
|
302 | 302 | :param clone_uri: |
|
303 | 303 | """ |
|
304 |
from rhodecode.lib.utils import |
|
|
304 | from rhodecode.lib.utils import is_valid_repo | |
|
305 | 305 | |
|
306 | 306 | if new_parent_id: |
|
307 | 307 | paths = Group.get(new_parent_id).full_path.split(Group.url_sep()) |
@@ -312,7 +312,7 b' class RepoModel(BaseModel):' | |||
|
312 | 312 | repo_path = os.path.join(*map(lambda x:safe_str(x), |
|
313 | 313 | [self.repos_path, new_parent_path, repo_name])) |
|
314 | 314 | |
|
315 |
if |
|
|
315 | if is_valid_repo(repo_path, self.repos_path) is False: | |
|
316 | 316 | log.info('creating repo %s in %s @ %s', repo_name, repo_path, |
|
317 | 317 | clone_uri) |
|
318 | 318 | backend = get_backend(alias) |
General Comments 0
You need to be logged in to leave comments.
Login now