WebM files are served as Content-Type: application/octet-stream
Opened this issue · 6 comments
It should be video/webm
; otherwise many browsers treat it as a download. Similarly .ogv
should be video/ogg
. .mp4
appears to be working correctly. I haven't tried any other types.
I believe this is a result of two things: Nginx being set to default to application/octet-stream, and Fuwa simply serving files without any MIME type checking/setting. I'm sure Flask MIME operations are supported at some level and can be integrated fairly easily.
Flask should detect the MIME type automatically. Maybe it's really limited?
Is there not some form of more advanced MIME detection/header setting with Flask?
Sure, you can pass mimetype
to send_from_directory
and do the detection yourself
I assume Python has some way to read the first few bytes of any given file and return the MIME type. Using detection like that with manual mimetype setting should probably work.
The file object on upload should have a content type var