dont set None as content_type
This commit is contained in:
parent
c87a6eddba
commit
5e0193d149
1 changed files with 4 additions and 2 deletions
|
@ -24,10 +24,12 @@ def HttpFileResponse(path, content_type=None, filename=None):
|
||||||
if root and path.startswith(root):
|
if root and path.startswith(root):
|
||||||
path = url + path[len(root)+1:]
|
path = url + path[len(root)+1:]
|
||||||
response['X-Accel-Redirect'] = path
|
response['X-Accel-Redirect'] = path
|
||||||
|
if content_type:
|
||||||
response['Content-Type'] = content_type
|
response['Content-Type'] = content_type
|
||||||
elif getattr(settings, 'XSENDFILE', False):
|
elif getattr(settings, 'XSENDFILE', False):
|
||||||
response = HttpResponse()
|
response = HttpResponse()
|
||||||
response['X-Sendfile'] = path
|
response['X-Sendfile'] = path
|
||||||
|
if content_type:
|
||||||
response['Content-Type'] = content_type
|
response['Content-Type'] = content_type
|
||||||
response['Content-Length'] = os.stat(path).st_size
|
response['Content-Length'] = os.stat(path).st_size
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue