##// END OF EJS Templates
slugs: make special chars not be replaced by '-'. THis produces a much...
marcink -
r1147:0b331b7a default
parent child Browse files
Show More
@@ -62,7 +62,7 b" REMOVED_REPO_PAT = re.compile(r'rm__\\d{8"
62 # String which contains characters that are not allowed in slug names for
62 # String which contains characters that are not allowed in slug names for
63 # repositories or repository groups. It is properly escaped to use it in
63 # repositories or repository groups. It is properly escaped to use it in
64 # regular expressions.
64 # regular expressions.
65 SLUG_BAD_CHARS = re.escape('`?=[]\;\'"<>,/~!@#$%^&*()+{}|: ')
65 SLUG_BAD_CHARS = re.escape('`?=[]\;\'"<>,/~!@#$%^&*()+{}|:')
66
66
67 # Regex that matches forbidden characters in repo/group slugs.
67 # Regex that matches forbidden characters in repo/group slugs.
68 SLUG_BAD_CHAR_RE = re.compile('[{}]'.format(SLUG_BAD_CHARS))
68 SLUG_BAD_CHAR_RE = re.compile('[{}]'.format(SLUG_BAD_CHARS))
@@ -85,7 +85,8 b' def repo_name_slug(value):'
85 replacement_char = '-'
85 replacement_char = '-'
86
86
87 slug = remove_formatting(value)
87 slug = remove_formatting(value)
88 slug = SLUG_BAD_CHAR_RE.sub(replacement_char, slug)
88 slug = SLUG_BAD_CHAR_RE.sub('', slug)
89 slug = re.sub('[\s]+', '-', slug)
89 slug = collapse(slug, replacement_char)
90 slug = collapse(slug, replacement_char)
90 return slug
91 return slug
91
92
General Comments 0
You need to be logged in to leave comments. Login now