diff --git a/rhodecode/apps/_base/__init__.py b/rhodecode/apps/_base/__init__.py --- a/rhodecode/apps/_base/__init__.py +++ b/rhodecode/apps/_base/__init__.py @@ -618,8 +618,13 @@ class RepoRoutePredicate(object): return repo_name = info['match']['repo_name'] - if repo_name != repo_name_slug(repo_name): + + repo_name_parts = repo_name.split('/') + repo_slugs = [x for x in map(lambda x: repo_name_slug(x), repo_name_parts)] + + if repo_name_parts != repo_slugs: # short-skip if the repo-name doesn't follow slug rule + log.warning('repo_name: %s is different than slug %s', repo_name_parts, repo_slugs) return False repo_model = repo.RepoModel() @@ -727,7 +732,12 @@ class RepoGroupRoutePredicate(object): return repo_group_name = info['match']['repo_group_name'] - if repo_group_name != repo_name_slug(repo_group_name): + + repo_group_name_parts = repo_group_name.split('/') + repo_group_slugs = [x for x in map(lambda x: repo_name_slug(x), repo_group_name_parts)] + if repo_group_name_parts != repo_group_slugs: + # short-skip if the repo-name doesn't follow slug rule + log.warning('repo_group_name: %s is different than slug %s', repo_group_name_parts, repo_group_slugs) return False repo_group_model = repo_group.RepoGroupModel() diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -66,7 +66,7 @@ REMOVED_REPO_PAT = re.compile(r'rm__\d{8 SLUG_BAD_CHARS = re.escape('`?=[]\;\'"<>,/~!@#$%^&*()+{}|:') # Regex that matches forbidden characters in repo/group slugs. -SLUG_BAD_CHAR_RE = re.compile('[{}]'.format(SLUG_BAD_CHARS)) +SLUG_BAD_CHAR_RE = re.compile('[{}\x00-\x08\x0b-\x0c\x0e-\x1f]'.format(SLUG_BAD_CHARS)) # Regex that matches allowed characters in repo/group slugs. SLUG_GOOD_CHAR_RE = re.compile('[^{}]'.format(SLUG_BAD_CHARS))