kopia lustrzana https://github.com/snarfed/bridgy-fed
user page bug fix, handle AS1 inner objects with composite url values
fixes https://console.cloud.google.com/errors/detail/CNGc5drA4f7uOA;time=P30D?project=bridgy-federatedpull/445/head
rodzic
78cef17c9a
commit
6dc4705a56
6
pages.py
6
pages.py
|
@ -222,9 +222,11 @@ def fetch_objects(query):
|
||||||
content = (inner_obj.get('content')
|
content = (inner_obj.get('content')
|
||||||
or inner_obj.get('displayName')
|
or inner_obj.get('displayName')
|
||||||
or inner_obj.get('summary'))
|
or inner_obj.get('summary'))
|
||||||
url = util.get_first(inner_obj, 'url') or inner_obj.get('id')
|
urls = as1.object_urls(inner_obj)
|
||||||
|
id = common.redirect_unwrap(inner_obj.get('id', ''))
|
||||||
|
url = urls[0] if urls else id
|
||||||
if (type == 'update' and obj.domains and
|
if (type == 'update' and obj.domains and
|
||||||
inner_obj.get('id', '').strip('/') == f'https://{obj.domains[0]}'):
|
id.strip('/') == f'https://{obj.domains[0]}'):
|
||||||
obj.phrase = 'updated'
|
obj.phrase = 'updated'
|
||||||
obj.as1.update({
|
obj.as1.update({
|
||||||
'content': 'their profile',
|
'content': 'their profile',
|
||||||
|
|
|
@ -63,6 +63,19 @@ class PagesTest(testutil.TestCase):
|
||||||
got = self.client.get('/user/user.com')
|
got = self.client.get('/user/user.com')
|
||||||
self.assert_equals(200, got.status_code)
|
self.assert_equals(200, got.status_code)
|
||||||
|
|
||||||
|
def test_user_object_url_object(self):
|
||||||
|
with app.test_request_context('/'):
|
||||||
|
Object(id='a', domains=['user.com'], labels=['notification'], our_as1={
|
||||||
|
**REPOST_AS2,
|
||||||
|
'object': {
|
||||||
|
'id': 'https://mas.to/toot/id',
|
||||||
|
'url': {'value': 'http://foo', 'displayName': 'bar'},
|
||||||
|
},
|
||||||
|
}).put()
|
||||||
|
|
||||||
|
got = self.client.get('/user/user.com')
|
||||||
|
self.assert_equals(200, got.status_code)
|
||||||
|
|
||||||
@patch('requests.get')
|
@patch('requests.get')
|
||||||
def test_check_web_site(self, mock_get):
|
def test_check_web_site(self, mock_get):
|
||||||
redir = 'http://localhost/.well-known/webfinger?resource=acct:orig@orig'
|
redir = 'http://localhost/.well-known/webfinger?resource=acct:orig@orig'
|
||||||
|
|
Ładowanie…
Reference in New Issue