kopia lustrzana https://github.com/snarfed/bridgy-fed
activitypub actor and inbox: error on bad ids
eg status.php, looks like a domain but isn't fixes https://console.cloud.google.com/errors/detail/CMyE7OD8zd6SnwE;time=P30D?project=bridgy-federatedpull/655/head
rodzic
771de9770e
commit
59e9895ab4
|
@ -715,7 +715,8 @@ def postprocess_as2_actor(actor, wrap=True):
|
|||
def actor(handle_or_id):
|
||||
"""Serves a user's AS2 actor from the datastore."""
|
||||
cls = Protocol.for_request(fed=PROTOCOLS['web'])
|
||||
assert cls
|
||||
if not cls:
|
||||
error(f"Couldn't determine protocol", status=404)
|
||||
|
||||
if cls.owns_id(handle_or_id) is False:
|
||||
if cls.owns_handle(handle_or_id) is False:
|
||||
|
|
|
@ -417,6 +417,11 @@ class ActivityPubTest(TestCase):
|
|||
got = self.client.get('/ap/fake/fake:handle:nope')
|
||||
self.assertEqual(404, got.status_code)
|
||||
|
||||
def test_actor_no_matching_protocol(self, *_):
|
||||
resp = self.client.get('/foo.json',
|
||||
base_url='https://bridgy-federated.appspot.com/')
|
||||
self.assertEqual(404, resp.status_code)
|
||||
|
||||
def test_individual_inbox_no_user(self, mock_head, mock_get, mock_post):
|
||||
self.user.key.delete()
|
||||
|
||||
|
@ -437,6 +442,10 @@ class ActivityPubTest(TestCase):
|
|||
resp = self.post('/ap/sharedInbox', json=note)
|
||||
self.assertEqual(400, resp.status_code)
|
||||
|
||||
def test_inbox_no_matching_protocol(self, *_):
|
||||
resp = self.post('/foo.json/inbox', json=NOTE)
|
||||
self.assertEqual(400, resp.status_code)
|
||||
|
||||
def test_inbox_reply_object(self, mock_head, mock_get, mock_post):
|
||||
self._test_inbox_reply(REPLY_OBJECT, mock_head, mock_get, mock_post)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue