Use compiled regex
This commit is contained in:
parent
8f8b884430
commit
44b4fc5f50
|
@ -88,6 +88,9 @@ import time
|
||||||
logger = logging.getLogger("synapse.app.homeserver")
|
logger = logging.getLogger("synapse.app.homeserver")
|
||||||
|
|
||||||
|
|
||||||
|
ACCESS_TOKEN_RE = re.compile(r'(\?.*access(_|%5[Ff])token=)[^&]*(.*)$')
|
||||||
|
|
||||||
|
|
||||||
def gz_wrap(r):
|
def gz_wrap(r):
|
||||||
return EncodingResourceWrapper(r, [GzipEncoderFactory()])
|
return EncodingResourceWrapper(r, [GzipEncoderFactory()])
|
||||||
|
|
||||||
|
@ -495,8 +498,7 @@ class SynapseRequest(Request):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_redacted_uri(self):
|
def get_redacted_uri(self):
|
||||||
return re.sub(
|
return ACCESS_TOKEN_RE.sub(
|
||||||
r'(\?.*accesss(_|%5[Ff])token=)[^&]*(.*)$',
|
|
||||||
r'\1<redacted>\3',
|
r'\1<redacted>\3',
|
||||||
self.uri
|
self.uri
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue