Show More
@@ -618,8 +618,13 b' class RepoRoutePredicate(object):' | |||||
618 | return |
|
618 | return | |
619 |
|
619 | |||
620 | repo_name = info['match']['repo_name'] |
|
620 | repo_name = info['match']['repo_name'] | |
621 | if repo_name != repo_name_slug(repo_name): |
|
621 | ||
|
622 | repo_name_parts = repo_name.split('/') | |||
|
623 | repo_slugs = [x for x in map(lambda x: repo_name_slug(x), repo_name_parts)] | |||
|
624 | ||||
|
625 | if repo_name_parts != repo_slugs: | |||
622 | # short-skip if the repo-name doesn't follow slug rule |
|
626 | # short-skip if the repo-name doesn't follow slug rule | |
|
627 | log.warning('repo_name: %s is different than slug %s', repo_name_parts, repo_slugs) | |||
623 | return False |
|
628 | return False | |
624 |
|
629 | |||
625 | repo_model = repo.RepoModel() |
|
630 | repo_model = repo.RepoModel() | |
@@ -727,7 +732,12 b' class RepoGroupRoutePredicate(object):' | |||||
727 | return |
|
732 | return | |
728 |
|
733 | |||
729 | repo_group_name = info['match']['repo_group_name'] |
|
734 | repo_group_name = info['match']['repo_group_name'] | |
730 | if repo_group_name != repo_name_slug(repo_group_name): |
|
735 | ||
|
736 | repo_group_name_parts = repo_group_name.split('/') | |||
|
737 | repo_group_slugs = [x for x in map(lambda x: repo_name_slug(x), repo_group_name_parts)] | |||
|
738 | if repo_group_name_parts != repo_group_slugs: | |||
|
739 | # short-skip if the repo-name doesn't follow slug rule | |||
|
740 | log.warning('repo_group_name: %s is different than slug %s', repo_group_name_parts, repo_group_slugs) | |||
731 | return False |
|
741 | return False | |
732 |
|
742 | |||
733 | repo_group_model = repo_group.RepoGroupModel() |
|
743 | repo_group_model = repo_group.RepoGroupModel() |
@@ -66,7 +66,7 b" REMOVED_REPO_PAT = re.compile(r'rm__\\d{8" | |||||
66 | SLUG_BAD_CHARS = re.escape('`?=[]\;\'"<>,/~!@#$%^&*()+{}|:') |
|
66 | SLUG_BAD_CHARS = re.escape('`?=[]\;\'"<>,/~!@#$%^&*()+{}|:') | |
67 |
|
67 | |||
68 | # Regex that matches forbidden characters in repo/group slugs. |
|
68 | # Regex that matches forbidden characters in repo/group slugs. | |
69 | SLUG_BAD_CHAR_RE = re.compile('[{}]'.format(SLUG_BAD_CHARS)) |
|
69 | SLUG_BAD_CHAR_RE = re.compile('[{}\x00-\x08\x0b-\x0c\x0e-\x1f]'.format(SLUG_BAD_CHARS)) | |
70 |
|
70 | |||
71 | # Regex that matches allowed characters in repo/group slugs. |
|
71 | # Regex that matches allowed characters in repo/group slugs. | |
72 | SLUG_GOOD_CHAR_RE = re.compile('[^{}]'.format(SLUG_BAD_CHARS)) |
|
72 | SLUG_GOOD_CHAR_RE = re.compile('[^{}]'.format(SLUG_BAD_CHARS)) |
General Comments 0
You need to be logged in to leave comments.
Login now