From f5f74dc150c198b01bb00615190e94aca2d130b4 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 21 Dec 2022 21:46:09 +0000 Subject: [PATCH] Further search fixing --- activities/services/search.py | 2 +- users/models/identity.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/activities/services/search.py b/activities/services/search.py index ddb30c7..621474f 100644 --- a/activities/services/search.py +++ b/activities/services/search.py @@ -26,7 +26,7 @@ class SearchService: return set() # Try to fetch the user by handle - handle = self.query.lstrip("@").lower() + handle = self.query.lstrip("@") results: set[Identity] = set() if "@" in handle: username, domain = handle.split("@", 1) diff --git a/users/models/identity.py b/users/models/identity.py index 9388b90..ae9b588 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -535,6 +535,9 @@ class Identity(StatorModel): try: data = response.json() except ValueError: + # Some servers return these with a 200 status code! + if b"not found" in response.content.lower(): + return None, None raise ValueError( "JSON parse error fetching webfinger", response.content,