Browse Source

File for StreamingHttpResponse must be read as binary both on Python 2 and
3

NeKit 9 years ago
parent
commit
c27b1444fc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      misago/core/fileserver.py

+ 1 - 1
misago/core/fileserver.py

@@ -41,7 +41,7 @@ def rewrite_file_path(file_path):
 
 
 
 
 def make_stream_response(file_path, content_type, file_size, attachment=None):
 def make_stream_response(file_path, content_type, file_size, attachment=None):
-    response = StreamingHttpResponse(open(file_path, 'r'))
+    response = StreamingHttpResponse(open(file_path, 'rb'))
 
 
     response['Content-Type'] = content_type
     response['Content-Type'] = content_type
     response['Content-Length'] = file_size
     response['Content-Length'] = file_size