Correctly handle Matrix URLs that do not define a port (#900)

This commit is contained in:
Chris Caron 2023-07-06 19:46:42 -04:00 committed by GitHub
parent 2b57c5dc34
commit 4cda4bf59e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -991,11 +991,11 @@ class NotifyMatrix(NotifyBase):
default_port = 443 if self.secure else 80 default_port = 443 if self.secure else 80
url = \ url = \
'{schema}://{hostname}:{port}{matrix_api}{path}'.format( '{schema}://{hostname}{port}{matrix_api}{path}'.format(
schema='https' if self.secure else 'http', schema='https' if self.secure else 'http',
hostname=self.host, hostname=self.host,
port='' if self.port is None port='' if self.port is None
or self.port == default_port else self.port, or self.port == default_port else f':{self.port}',
matrix_api=MATRIX_V2_API_PATH, matrix_api=MATRIX_V2_API_PATH,
path=path) path=path)
@ -1031,6 +1031,7 @@ class NotifyMatrix(NotifyBase):
timeout=self.request_timeout, timeout=self.request_timeout,
) )
self.logger.debug('Matrix Response: %s' % str(r.content))
response = loads(r.content) response = loads(r.content)
if r.status_code == 429: if r.status_code == 429: