diff --git a/tests/test_webmention.py b/tests/test_webmention.py index d8489a7..3e91507 100644 --- a/tests/test_webmention.py +++ b/tests/test_webmention.py @@ -1101,10 +1101,11 @@ class WebmentionTest(testutil.TestCase): self.req('https://orig/'), )) + id = 'https://orig/#update-2022-01-02T03:04:05+00:00' self.assert_deliveries(mock_post, ('https://shared/inbox', 'https://inbox'), { '@context': 'https://www.w3.org/ns/activitystreams', 'type': 'Update', - 'id': 'http://localhost/r/https://orig/#update-2022-01-02T03:04:05+00:00', + 'id': f'http://localhost/r/{id}', 'actor': 'http://localhost/orig', 'object': { **ACTOR_AS2_FULL, @@ -1114,12 +1115,12 @@ class WebmentionTest(testutil.TestCase): }) expected_as1 = { - 'id': 'https://orig/#update-2022-01-02T03:04:05+00:00', + 'id': id, 'objectType': 'activity', 'verb': 'update', 'object': ACTOR_AS1_UNWRAPPED, } - self.assert_object(f'https://orig/', + self.assert_object(id, domains=['orig'], source_protocol='webmention', status='complete', diff --git a/webmention.py b/webmention.py index 3f20b03..4558080 100644 --- a/webmention.py +++ b/webmention.py @@ -138,7 +138,8 @@ class Webmention(View): log_data = True type = as1.object_type(self.source_as1) - obj = Object.get_by_id(self.source_url) + obj_id = self.source_as1.get('id') or self.source_url + obj = Object.get_by_id(obj_id) changed = False if obj: @@ -158,7 +159,7 @@ class Webmention(View): logger.info(f'Content has changed from last time at {obj.updated}! Redelivering to all inboxes: {obj.undelivered}') else: - obj = Object(id=self.source_url, delivered=[], failed=[], + obj = Object(id=obj_id, delivered=[], failed=[], undelivered=[Target(uri=uri, protocol='activitypub') for uri in inboxes_to_targets.keys()], status='in progress')