more error handling for AS2 objects without id or URL

follows b7e44c9295. fixes https://console.cloud.google.com/errors/CLnu14G46vHLOg
pull/59/head
Ryan Barrett 2019-04-15 08:14:37 -07:00
rodzic b7e44c9295
commit 5bc639216e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -351,6 +351,8 @@ def redirect_wrap(url):
https://github.com/snarfed/bridgy-fed/issues/16#issuecomment-424799599
https://github.com/tootsuite/mastodon/pull/6219#issuecomment-429142747
"""
if not url:
return url
if url.startswith(REDIRECT_PREFIX):
return url
return REDIRECT_PREFIX + url

Wyświetl plik

@ -64,3 +64,7 @@ class CommonTest(testutil.TestCase):
with self.assertRaises(exc.HTTPBadGateway):
resp = common.get_as2('http://orig')
def test_redirect_wrap_empty(self):
self.assertIsNone(common.redirect_wrap(None))
self.assertEqual('', common.redirect_wrap(''))