Do not canonicalise non json content in the search endpoint (#654)

This commit is contained in:
Humberto Rocha 2023-11-15 17:00:56 -05:00 committed by GitHub
parent cc9e397f60
commit 2f546dfa74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,6 +81,9 @@ class SearchService:
return None return None
if response.status_code >= 400: if response.status_code >= 400:
return None 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) document = canonicalise(response.json(), include_security=True)
type = document.get("type", "unknown").lower() type = document.get("type", "unknown").lower()