From 2f546dfa74e38fab5bf47a2f4da04e6008010fd7 Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Wed, 15 Nov 2023 17:00:56 -0500 Subject: [PATCH] Do not canonicalise non json content in the search endpoint (#654) --- activities/services/search.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/activities/services/search.py b/activities/services/search.py index 0038c84..cbac286 100644 --- a/activities/services/search.py +++ b/activities/services/search.py @@ -81,6 +81,9 @@ class SearchService: return None if response.status_code >= 400: return None + content_type = response.headers.get("Content-Type", "").lower() + if content_type not in ["application/json", "application/ld+json"]: + return None document = canonicalise(response.json(), include_security=True) type = document.get("type", "unknown").lower()