kopia lustrzana https://github.com/snarfed/bridgy-fed
common.postprocess_as2 bug fix for multiply valued AS2 url field
fixes https://console.cloud.google.com/errors/detail/CMOZzPLojuud_QE;time=P30D?project=bridgy-federatedpull/344/head
rodzic
47aec1c5ea
commit
d4741310e7
|
@ -391,7 +391,9 @@ def postprocess_as2(activity, user=None, target=None):
|
|||
# assert activity.get('id') or (isinstance(obj, dict) and obj.get('id'))
|
||||
|
||||
activity['id'] = redirect_wrap(activity.get('id'))
|
||||
activity['url'] = redirect_wrap(activity.get('url'))
|
||||
activity['url'] = [redirect_wrap(u) for u in util.get_list(activity, 'url')]
|
||||
if len(activity['url']) == 1:
|
||||
activity['url'] = activity['url'][0]
|
||||
|
||||
# copy image(s) into attachment(s). may be Mastodon-specific.
|
||||
# https://github.com/snarfed/bridgy-fed/issues/33#issuecomment-440965618
|
||||
|
|
|
@ -99,6 +99,17 @@ class CommonTest(testutil.TestCase):
|
|||
'inReplyTo': ['foo', 'bar'],
|
||||
}, user=User(id='foo.com')))
|
||||
|
||||
def test_postprocess_as2_multiple_url(self):
|
||||
with app.test_request_context('/'):
|
||||
self.assert_equals({
|
||||
'id': 'http://localhost/r/xyz',
|
||||
'url': ['http://localhost/r/foo', 'http://localhost/r/bar'],
|
||||
'to': [as2.PUBLIC_AUDIENCE],
|
||||
}, common.postprocess_as2({
|
||||
'id': 'xyz',
|
||||
'url': ['foo', 'bar'],
|
||||
}, user=User(id='foo.com')))
|
||||
|
||||
def test_postprocess_as2_actor_attributedTo(self):
|
||||
with app.test_request_context('/'):
|
||||
self.assert_equals({
|
||||
|
|
Ładowanie…
Reference in New Issue