xep_0454: Ensure format_url returns a str
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
14a6c7801d
commit
7222ade0dd
2 changed files with 7 additions and 1 deletions
|
@ -117,7 +117,7 @@ class XEP_0454(BasePlugin):
|
|||
"""Helper to format a HTTPS URL to an AESGCM URI"""
|
||||
if not url.startswith('https://') or url.find('#') != -1:
|
||||
raise InvalidURL
|
||||
url = 'aesgcm://' + url.removeprefix('https://') + '#' + fragment
|
||||
return 'aesgcm://' + url.removeprefix('https://') + '#' + fragment
|
||||
|
||||
async def upload_file(
|
||||
self,
|
||||
|
|
|
@ -32,4 +32,10 @@ class TestMediaSharing(SlixTest):
|
|||
|
||||
self.assertEqual(plain, result)
|
||||
|
||||
def testFormatURL(self):
|
||||
url = 'https://foo.bar'
|
||||
fragment = 'a' * 88
|
||||
result = XEP_0454.format_url(url, fragment)
|
||||
self.assertEqual('aesgcm://foo.bar#' + 'a' * 88, result)
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestMediaSharing)
|
||||
|
|
Loading…
Reference in a new issue