Add r string literal for regexps

This commit is contained in:
shortcutme 2019-07-01 16:24:23 +02:00
parent 43f833e604
commit 62401b24ec
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
4 changed files with 27 additions and 26 deletions

View file

@ -312,7 +312,7 @@ class UiRequest(object):
extra_headers = {}
script_nonce = self.getScriptNonce()
match = re.match("/(?P<address>[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
match = re.match(r"/(?P<address>[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
just_added = False
if match:
address = match.group("address")
@ -525,7 +525,7 @@ class UiRequest(object):
if ".." in path or "./" in path:
raise SecurityError("Invalid path")
match = re.match("/media/(?P<address>[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
match = re.match(r"/media/(?P<address>[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
if match:
path_parts = match.groupdict()
path_parts["request_address"] = path_parts["address"] # Original request address (for Merger sites)