kopia lustrzana https://github.com/snarfed/bridgy-fed
bug fix for pds_for change in e86763f: don't use Object.as1 since that infinite loops
rodzic
e86763f654
commit
048cd17ba5
|
@ -178,7 +178,9 @@ class ATProto(User, Protocol):
|
|||
# None here? or do we need this path to return BF's URL so that we
|
||||
# then create the DID for non-ATP users on demand?
|
||||
|
||||
if obj.as1:
|
||||
# don't use Object.as1 if bsky is set, since that conversion calls
|
||||
# pds_for, which would infinite loop
|
||||
if not obj.bsky and obj.as1:
|
||||
if owner := as1.get_owner(obj.as1):
|
||||
if user_key := Protocol.key_for(owner):
|
||||
if user := user_key.get():
|
||||
|
|
|
@ -156,6 +156,14 @@ class ATProtoTest(TestCase):
|
|||
got = ATProto.pds_for(Object(id='at://did:plc:user/co.ll/123'))
|
||||
self.assertEqual('https://some.pds', got)
|
||||
|
||||
def test_pds_for_bsky_record_stored_did(self):
|
||||
# check that we don't use Object.as1, which would cause an infinite loop
|
||||
self.assertIsNone(ATProto.pds_for(Object(id='at://did:bob/coll/post', bsky={
|
||||
'$type': 'app.bsky.feed.post',
|
||||
'uri': 'at://did:bob/coll/post',
|
||||
'cid': 'my sidd',
|
||||
})))
|
||||
|
||||
@patch('requests.get', return_value=requests_response(DID_DOC))
|
||||
def test_pds_for_fetch_did(self, mock_get):
|
||||
got = ATProto.pds_for(Object(id='at://did:plc:user/co.ll/123'))
|
||||
|
|
Ładowanie…
Reference in New Issue