Handle servers that return wrong webfinger payload (#415)

pull/417/head
Michael Manfre 2023-01-14 16:19:47 -05:00 zatwierdzone przez GitHub
rodzic f69c7304c1
commit 1f44e93518
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 12 dodań i 8 usunięć

Wyświetl plik

@ -683,14 +683,18 @@ class Identity(StatorModel):
"JSON parse error fetching webfinger",
response.content,
)
if data["subject"].startswith("acct:"):
data["subject"] = data["subject"][5:]
for link in data["links"]:
if (
link.get("type") == "application/activity+json"
and link.get("rel") == "self"
):
return link["href"], data["subject"]
try:
if data["subject"].startswith("acct:"):
data["subject"] = data["subject"][5:]
for link in data["links"]:
if (
link.get("type") == "application/activity+json"
and link.get("rel") == "self"
):
return link["href"], data["subject"]
except KeyError:
# Server returning wrong payload structure
pass
return None, None
async def fetch_actor(self) -> bool: