kopia lustrzana https://github.com/snarfed/bridgy-fed
activitypub.postprocess_as2_actor: bug fix for publicKey w/Web.ap_subdomain
rodzic
7dce96d984
commit
d538928fe6
|
@ -701,7 +701,8 @@ def postprocess_as2_actor(actor, user=None):
|
|||
urls[0] = redirect_wrap(urls[0])
|
||||
|
||||
id = actor.get('id')
|
||||
if not id or user.is_web_url(id):
|
||||
user_id = user.key.id()
|
||||
if not id or user.is_web_url(id) or unwrap(id) in (user_id, f'www.{user_id}'):
|
||||
id = actor['id'] = user.id_as(ActivityPub)
|
||||
|
||||
actor['url'] = urls[0] if len(urls) == 1 else urls
|
||||
|
|
|
@ -1884,6 +1884,14 @@ class ActivityPubUtilsTest(TestCase):
|
|||
}],
|
||||
}, user=self.user)['preferredUsername'])
|
||||
|
||||
def test_postprocess_as2_user_wrapped_id(self):
|
||||
for id in 'http://fed.brid.gy/user.com', 'http://fed.brid.gy/www.user.com':
|
||||
got = postprocess_as2_actor(as2.from_as1({
|
||||
'objectType': 'person',
|
||||
'id': id,
|
||||
}), user=self.user)
|
||||
self.assert_equals('http://localhost/user.com', got['id'])
|
||||
|
||||
def test_postprocess_as2_mentions_into_cc(self):
|
||||
obj = copy.deepcopy(MENTION_OBJECT)
|
||||
del obj['cc']
|
||||
|
|
Ładowanie…
Reference in New Issue