diff --git a/common.py b/common.py index 5689498..62b5fba 100644 --- a/common.py +++ b/common.py @@ -417,9 +417,9 @@ def postprocess_as2(activity, user=None, target=None, create=True): # copy image(s) into attachment(s). may be Mastodon-specific. # https://github.com/snarfed/bridgy-fed/issues/33#issuecomment-440965618 obj_or_activity = obj if isinstance(obj, dict) else activity - img = obj_or_activity.get('image') + img = util.get_list(obj_or_activity, 'image') if img: - obj_or_activity.setdefault('attachment', []).append(img) + obj_or_activity.setdefault('attachment', []).extend(img) # cc target's author(s) and recipients # https://www.w3.org/TR/activitystreams-vocabulary/#audienceTargeting diff --git a/tests/test_common.py b/tests/test_common.py index dd37c96..c089a9b 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -110,6 +110,18 @@ class CommonTest(testutil.TestCase): 'url': ['foo', 'bar'], }, user=User(id='foo.com'))) + def test_postprocess_as2_multiple_image(self): + with app.test_request_context('/'): + self.assert_equals({ + 'id': 'http://localhost/r/xyz', + 'attachment': [{'url': 'http://r/foo'}, {'url': 'http://r/bar'}], + 'image': [{'url': 'http://r/foo'}, {'url': 'http://r/bar'}], + 'to': [as2.PUBLIC_AUDIENCE], + }, common.postprocess_as2({ + 'id': 'xyz', + 'image': [{'url': 'http://r/foo'}, {'url': 'http://r/bar'}], + }, user=User(id='foo.com'))) + def test_postprocess_as2_actor_attributedTo(self): with app.test_request_context('/'): self.assert_equals({ diff --git a/webmention.py b/webmention.py index 8cdc25d..5dfd37e 100644 --- a/webmention.py +++ b/webmention.py @@ -231,9 +231,9 @@ class Webmention(View): }, ) # not actually an error - msg = ("Updating profile on followers' instances" + msg = ("Updating profile on followers' instances..." if self.source_url.strip('/') == f'https://{self.source_domain}' - else 'Delivering to followers') + else 'Delivering to followers...') error(msg, status=202) inboxes = set()