Regex string escape properly
parent
f0edd22bba
commit
b774e081d7
|
@ -314,24 +314,24 @@ PROGRAMMING_LANGUAGES = (
|
|||
|
||||
LOG_TEMPLATE = '(Build) [{project}:{version}] {msg}'
|
||||
|
||||
PROJECT_PK_REGEX = '(?:[-\w]+)'
|
||||
PROJECT_SLUG_REGEX = '(?:[-\w]+)'
|
||||
PROJECT_PK_REGEX = r'(?:[-\w]+)'
|
||||
PROJECT_SLUG_REGEX = r'(?:[-\w]+)'
|
||||
|
||||
GITHUB_REGEXS = [
|
||||
re.compile('github.com/(.+)/(.+)(?:\.git){1}$'),
|
||||
re.compile('github.com/(.+)/(.+)'),
|
||||
re.compile('github.com:(.+)/(.+)\.git$'),
|
||||
re.compile(r'github.com/(.+)/(.+)(?:\.git){1}$'),
|
||||
re.compile(r'github.com/(.+)/(.+)'),
|
||||
re.compile(r'github.com:(.+)/(.+)\.git$'),
|
||||
]
|
||||
BITBUCKET_REGEXS = [
|
||||
re.compile('bitbucket.org/(.+)/(.+)\.git$'),
|
||||
re.compile('@bitbucket.org/(.+)/(.+)\.git$'),
|
||||
re.compile('bitbucket.org/(.+)/(.+)/?'),
|
||||
re.compile('bitbucket.org:(.+)/(.+)\.git$'),
|
||||
re.compile(r'bitbucket.org/(.+)/(.+)\.git$'),
|
||||
re.compile(r'@bitbucket.org/(.+)/(.+)\.git$'),
|
||||
re.compile(r'bitbucket.org/(.+)/(.+)/?'),
|
||||
re.compile(r'bitbucket.org:(.+)/(.+)\.git$'),
|
||||
]
|
||||
GITLAB_REGEXS = [
|
||||
re.compile('gitlab.com/(.+)/(.+)(?:\.git){1}$'),
|
||||
re.compile('gitlab.com/(.+)/(.+)'),
|
||||
re.compile('gitlab.com:(.+)/(.+)\.git$'),
|
||||
re.compile(r'gitlab.com/(.+)/(.+)(?:\.git){1}$'),
|
||||
re.compile(r'gitlab.com/(.+)/(.+)'),
|
||||
re.compile(r'gitlab.com:(.+)/(.+)\.git$'),
|
||||
]
|
||||
GITHUB_URL = (
|
||||
'https://github.com/{user}/{repo}/'
|
||||
|
|
|
@ -103,7 +103,7 @@ def parse_path_from_file(file_path):
|
|||
# "path/index.html" => "path/index"
|
||||
# "/path/index" => "path/index"
|
||||
path = re.sub('/$', '/index', path)
|
||||
path = re.sub('\.html$', '', path)
|
||||
path = re.sub(r'\.html$', '', path)
|
||||
path = re.sub('^/', '', path)
|
||||
|
||||
return path
|
||||
|
|
|
@ -296,8 +296,8 @@ class CommunityBaseSettings(Settings):
|
|||
|
||||
# CORS
|
||||
CORS_ORIGIN_REGEX_WHITELIST = (
|
||||
'^http://(.+)\.readthedocs\.io$',
|
||||
'^https://(.+)\.readthedocs\.io$'
|
||||
r'^http://(.+)\.readthedocs\.io$',
|
||||
r'^https://(.+)\.readthedocs\.io$',
|
||||
)
|
||||
# So people can post to their accounts
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
|
|
Loading…
Reference in New Issue