Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add 10s timeout to check_image_type head requests (#2426)
Zack Kridae10b82dcdf06
diff --git a/api/api/utils/photon.py b/api/api/utils/photon.pyindex dcb79eeb5..1e161736c 100644--- a/api/api/utils/photon.py+++ b/api/api/utils/photon.py@@ -63,7 +63,7 @@ def check_image_type(image_url: str, media_obj) -> None:if not ext:# If the extension is still not present, try getting it from the content typetry:- response = requests.head(image_url)+ response = requests.head(image_url, timeout=10)response.raise_for_status()except Exception as exc:sentry_sdk.capture_exception(exc)