kopia lustrzana https://github.com/snarfed/bridgy-fed
/r: handle trailing garbage chars
fixes https://console.cloud.google.com/errors/CO-fpZfMq_6ktgEpull/79/head
rodzic
e4d285523f
commit
c6f0c417a0
|
@ -48,7 +48,7 @@ def redir(to):
|
|||
domains = set((util.domain_from_link(to),
|
||||
urllib.parse.urlparse(to).hostname))
|
||||
for domain in domains:
|
||||
if MagicKey.get_by_id(domain):
|
||||
if domain and MagicKey.get_by_id(domain):
|
||||
logging.info(f'Found MagicKey for domain {domain}')
|
||||
break
|
||||
else:
|
||||
|
|
|
@ -39,6 +39,10 @@ class RedirectTest(testutil.TestCase):
|
|||
self.assertEqual(301, got.status_code)
|
||||
self.assertEqual('https://foo.com/bar', got.headers['Location'])
|
||||
|
||||
def test_redirect_trailing_garbage_chars(self):
|
||||
got = self.client.get(r'/r/https://v2.jacky.wtf\"')
|
||||
self.assertEqual(404, got.status_code)
|
||||
|
||||
def test_as2(self):
|
||||
self._test_as2(common.CONTENT_TYPE_AS2)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue