kopia lustrzana https://github.com/snarfed/bridgy-fed
more error handling for AS2 objects without id or URL
follows b7e44c9295
. fixes https://console.cloud.google.com/errors/CLnu14G46vHLOg
pull/59/head
rodzic
b7e44c9295
commit
5bc639216e
|
@ -351,6 +351,8 @@ def redirect_wrap(url):
|
||||||
https://github.com/snarfed/bridgy-fed/issues/16#issuecomment-424799599
|
https://github.com/snarfed/bridgy-fed/issues/16#issuecomment-424799599
|
||||||
https://github.com/tootsuite/mastodon/pull/6219#issuecomment-429142747
|
https://github.com/tootsuite/mastodon/pull/6219#issuecomment-429142747
|
||||||
"""
|
"""
|
||||||
|
if not url:
|
||||||
|
return url
|
||||||
if url.startswith(REDIRECT_PREFIX):
|
if url.startswith(REDIRECT_PREFIX):
|
||||||
return url
|
return url
|
||||||
return REDIRECT_PREFIX + url
|
return REDIRECT_PREFIX + url
|
||||||
|
|
|
@ -64,3 +64,7 @@ class CommonTest(testutil.TestCase):
|
||||||
with self.assertRaises(exc.HTTPBadGateway):
|
with self.assertRaises(exc.HTTPBadGateway):
|
||||||
resp = common.get_as2('http://orig')
|
resp = common.get_as2('http://orig')
|
||||||
|
|
||||||
|
def test_redirect_wrap_empty(self):
|
||||||
|
self.assertIsNone(common.redirect_wrap(None))
|
||||||
|
self.assertEqual('', common.redirect_wrap(''))
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue