]> git.parisson.com Git - telemeta.git/commitdiff
Bugfix, finally fixes #200
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 4 Jun 2018 10:42:05 +0000 (12:42 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 4 Jun 2018 10:42:41 +0000 (12:42 +0200)
telemeta/views/core.py

index 9c07513793b0b005ef3b03ac6392e7ff14c58db9..b2dd116d2ab1c9fda426746bea0ef221c2b56288 100644 (file)
@@ -100,7 +100,10 @@ def serve_media(media_path, content_type="", buffering=True, streaming=False):
         return nginx_media_accel(media_path, content_type=content_type,
                                  buffering=buffering, streaming=streaming)
     else:
-        response = FileResponse(open(media_path, 'rb'))
+        try:
+            response = FileResponse(open(media_path, 'rb'))
+        except:    
+            response = StreamingHttpResponse(stream_from_file(media_path), content_type=content_type)
         filename = os.path.basename(media_path)
         if not streaming:
             response['Content-Disposition'] = 'attachment; ' + 'filename=' + filename