mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-26 01:01:00 +00:00
Handle servers that return wrong webfinger payload (#415)
This commit is contained in:
parent
f69c7304c1
commit
1f44e93518
1 changed files with 12 additions and 8 deletions
|
@ -683,6 +683,7 @@ class Identity(StatorModel):
|
|||
"JSON parse error fetching webfinger",
|
||||
response.content,
|
||||
)
|
||||
try:
|
||||
if data["subject"].startswith("acct:"):
|
||||
data["subject"] = data["subject"][5:]
|
||||
for link in data["links"]:
|
||||
|
@ -691,6 +692,9 @@ class Identity(StatorModel):
|
|||
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:
|
||||
|
|
Loading…
Reference in a new issue