anacronw / multer-s3

multer storage engine for amazon s3
MIT License
660 stars 190 forks source link

Fixed incorrect SVG content type upload #74

Closed wgminer closed 7 years ago

wgminer commented 7 years ago

multer-s3 is using the file-type package which explicitly does not support SVGs. Thus, file-type returns null for uploaded SVGs and they are uploaded with the default application/octet-stream content-type (instead of the correct image/svg+xml). This prevents the SVGs from rendering in browsers correctly. I removed the file-type package entirely because the mimetype was already included in the file object.

lirantal commented 7 years ago

seems like it's the png file test that is failing, not your test. is it also failing locally for you?

wgminer commented 7 years ago

Made a copy and paste error...should be fixed now :)

lirantal commented 7 years ago

:)

LinusU commented 7 years ago

I removed the file-type package entirely because the mimetype was already included in the file object.

That is the mimetype provided by the browser though, and thus can be set to anything. It's generally considered a very bad security practice to rely on that one.