mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
upload: Ensure that we always have a content-type.
Old uploads are stored without a content-type, and guess_type may not provide a type for them.
This commit is contained in:
committed by
Tim Abbott
parent
1bc7696c24
commit
0c6b3373be
@@ -131,8 +131,7 @@ def serve_local(
|
|||||||
return HttpResponseNotFound("<p>File not found</p>")
|
return HttpResponseNotFound("<p>File not found</p>")
|
||||||
|
|
||||||
if content_type is None:
|
if content_type is None:
|
||||||
content_type = guess_type(filename)[0]
|
content_type = guess_type(filename)[0] or "application/octet-stream"
|
||||||
assert content_type is not None
|
|
||||||
download = force_download or bare_content_type(content_type) not in INLINE_MIME_TYPES
|
download = force_download or bare_content_type(content_type) not in INLINE_MIME_TYPES
|
||||||
|
|
||||||
if settings.DEVELOPMENT:
|
if settings.DEVELOPMENT:
|
||||||
|
|||||||
Reference in New Issue
Block a user