♻️(backend) stop returning a 415 on cors-proxy endpoint
When the content-type return by the targeted url is not an image, the endpoint was returning a 415 status code. We don't want to provide this info anymore avoid disclosing information an attacker can use.
This commit is contained in:
@@ -1810,7 +1810,8 @@ class DocumentViewSet(
|
||||
|
||||
if not content_type.startswith("image/"):
|
||||
return drf.response.Response(
|
||||
status=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE
|
||||
{"detail": "Invalid URL used."},
|
||||
status=status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
|
||||
# Use StreamingHttpResponse with the response's iter_content to properly stream the data
|
||||
|
||||
Reference in New Issue
Block a user