Guad / fuwa

A Material design inspired filesharer for all
http://fuwa.se/
GNU General Public License v2.0
13 stars 6 forks source link

WebM files are served as Content-Type: application/octet-stream #30

Open ccd0 opened 9 years ago

ccd0 commented 9 years ago

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.

Luminarys commented 9 years ago

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.

Guad commented 9 years ago

Flask should detect the MIME type automatically. Maybe it's really limited?

Luminarys commented 9 years ago

Is there not some form of more advanced MIME detection/header setting with Flask?

Guad commented 9 years ago

Sure, you can pass mimetype to send_from_directory and do the detection yourself

Luminarys commented 9 years ago

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.

Guad commented 9 years ago

The file object on upload should have a content type var