Avoid using a tuple as a content type when guessed
Only use the content type with mimetypes.guess_type
This commit is contained in:
parent
c122ecf5e4
commit
6cacc7122b
1 changed files with 6 additions and 6 deletions
|
@ -378,15 +378,15 @@ class AjaxProxy(View):
|
||||||
return HttpResponseBadRequest("Timeout")
|
return HttpResponseBadRequest("Timeout")
|
||||||
else:
|
else:
|
||||||
status_code = proxied_request.code
|
status_code = proxied_request.code
|
||||||
mimetype = proxied_request.headers.get(
|
content_type = proxied_request.headers.get("Content-Type")
|
||||||
"Content-Type"
|
if not content_type:
|
||||||
) or mimetypes.guess_type(
|
content_type, encoding = mimetypes.guess_type(url)
|
||||||
url
|
|
||||||
) # noqa
|
|
||||||
content = proxied_request.read()
|
content = proxied_request.read()
|
||||||
# Quick hack to prevent Django from adding a Vary: Cookie header
|
# Quick hack to prevent Django from adding a Vary: Cookie header
|
||||||
self.request.session.accessed = False
|
self.request.session.accessed = False
|
||||||
response = HttpResponse(content, status=status_code, content_type=mimetype)
|
response = HttpResponse(
|
||||||
|
content, status=status_code, content_type=content_type
|
||||||
|
)
|
||||||
if ttl:
|
if ttl:
|
||||||
response["X-Accel-Expires"] = ttl
|
response["X-Accel-Expires"] = ttl
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue