Handle servers that return wrong webfinger payload (#415)
This commit is contained in:
parent
f69c7304c1
commit
1f44e93518
|
@ -683,14 +683,18 @@ class Identity(StatorModel):
|
||||||
"JSON parse error fetching webfinger",
|
"JSON parse error fetching webfinger",
|
||||||
response.content,
|
response.content,
|
||||||
)
|
)
|
||||||
if data["subject"].startswith("acct:"):
|
try:
|
||||||
data["subject"] = data["subject"][5:]
|
if data["subject"].startswith("acct:"):
|
||||||
for link in data["links"]:
|
data["subject"] = data["subject"][5:]
|
||||||
if (
|
for link in data["links"]:
|
||||||
link.get("type") == "application/activity+json"
|
if (
|
||||||
and link.get("rel") == "self"
|
link.get("type") == "application/activity+json"
|
||||||
):
|
and link.get("rel") == "self"
|
||||||
return link["href"], data["subject"]
|
):
|
||||||
|
return link["href"], data["subject"]
|
||||||
|
except KeyError:
|
||||||
|
# Server returning wrong payload structure
|
||||||
|
pass
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
async def fetch_actor(self) -> bool:
|
async def fetch_actor(self) -> bool:
|
||||||
|
|
Loading…
Reference in New Issue