Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upJPEG Images have .jpe extension - this can cause issues #7787
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I suppose we should just hardcode a special fix for jpeg? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mtippmann
Jun 12, 2018
I'm not familiar with the code-base :( and I'm not sure where the .jpe extension is coming from - in that case it was tweets by moa.party that ended up in .jpe - normal posts does seem to have the correct extension. Maybe adding a note to the deployment notes would be enough until the core issue can be tackled?
mtippmann
commented
Jun 12, 2018
|
I'm not familiar with the code-base :( and I'm not sure where the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ThibG
Jun 16, 2018
Collaborator
I believe the .jpe comes from the original filename and is preserved on upload (please tell me if I'm wrong). Which I don't really think is an incorrect behavior, but it can lead to the issue reported here.
I think this comes from 7db7d68, which changed the logic a bit regarding filename extensions.
I do not believe preserving the filename extension (if it matches the content-type) is wrong, but I'm not sure it has any merit either. I guess we should either revert to Paperclip's thingy or maybe unconditionally use the first (most common? I don't know if the mime/types package guarantees such a thing) returned extension?
|
I believe the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Dryusdan
Jun 17, 2018
So, I have a quick fix for this issue. Not in Mastodon but on reverse proxy (nginx for me), it's bad, it's ugly but it's work.
In file /etc/nginx/conf/mime.types or /etc/nginx/mime.types, on line image/jpeg we see this to values : jpeg jpg;, add jpe and restart nginx
It's work :)
Dryusdan
commented
Jun 17, 2018
|
So, I have a quick fix for this issue. Not in Mastodon but on reverse proxy (nginx for me), it's bad, it's ugly but it's work. It's work :) |
mtippmann commentedJun 11, 2018
•
edited
Edited 1 time
-
mtippmann
edited Jun 11, 2018 (most recent)
-
mtippmann
created Jun 11, 2018
If
.jpeis missing in the list of web-server mime types andx-content-type-options: nosniffheaders are set pictures are not shown but instead downloaded because the mime-type of the picture isapplication/octet-stream.nginx (at least 1.14.0) lacks
.jpein themime.typesfiles so this should be pretty common. also settingx-content-type-options: nosniffis considered best practice for security so this might affect quite a few instances.I've found a related pull-request: #3404
Fixing this might improve the out of box experience for a lot of installations.
thanks to @chpietsch@chaos.social for bringing it up:
https://social.bau-ha.us/@mt/100186932802506001
Mastodon 2.4.1 / nginx 1.14
master(If you're a user, don't worry about this).