webfinger: preserve order of u-urls from h-card

mastodon
Ryan Barrett 2017-08-19 13:34:06 -07:00
rodzic b7daa0e4ee
commit 26efa299d6
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -83,18 +83,18 @@ class WebFingerTest(unittest.TestCase):
self.assertEquals({
'subject': 'acct:@foo.com',
'aliases': [
'https://foo.com/',
'https://foo.com/about-me',
'https://foo.com/',
],
'magic_keys': [{'value': key.href()}],
'links': [{
'rel': 'http://webfinger.net/rel/profile-page',
'type': 'text/html',
'href': 'https://foo.com/'
'href': 'https://foo.com/about-me'
}, {
'rel': 'http://webfinger.net/rel/profile-page',
'type': 'text/html',
'href': 'https://foo.com/about-me'
'href': 'https://foo.com/'
}, {
'rel': 'magic-public-key',
'href': key.href(),

Wyświetl plik

@ -43,7 +43,7 @@ representative h-card</a> on %s""" % resp.url)
uri = '@%s' % domain
key = models.MagicKey.get_or_create(uri)
props = hcard.get('properties', {})
urls = sorted(set(props.get('url', []) + [resp.url]))
urls = util.dedupe_urls(props.get('url', []) + [resp.url])
# appengine_config.HOST
return util.trim_nulls({