Multiple instances of wrong MIME type in file uploads
Steps to reproduce
I don't have a reproduction for this and I'm not sure what causes it, but people who use Element X and upload media frequently result in uploads with invalid mimetypes specified -- in both the event JSON and in the mimetype passed to the media upload endpoint.
e.g. we see events like this
"content": {
<...>
"info": {
<...>
"mimetype": "image/*",
<...>
},
"msgtype": "m.image",
"url": "<...>"
},
Similarly, we have over 500 pieces of media in our database with the mime type image/*, which causes matrix-media-repo to fail to generate thumbnails.
Also, a separate issue maybe:
I have noticed that images uploaded in to encrypted rooms also get uploaded to the media upload endpoint with the "wrong" (i.e. original) mimetype. Encrypted media should be uploaded with the mimetype application/octet-stream to match the behavior of other clients.
Note: This is probably an information leak as it discloses to home-servers the types of files that users are sharing in E2EE chats.
(It is also inconvenient from the point of view of administration and being able to account encrypted media uploads.)
Outcome
--
Your phone model
No response
Operating system version
No response
Application version and app store
No response
Homeserver
No response
Will you send logs?
No
Are you willing to provide a PR?
No
maybe a helpful addition: for me wrong mime types appear when i use the camera from within element x, when i select an existing photo on the device from within element x or share from the gallery app to element x the mime type is correct
Here the same on EXA 25.02.0
Can we close it since https://github.com/matrix-org/matrix-rust-sdk/pull/4987 is merged?
Can we close it since matrix-org/matrix-rust-sdk#4987 is merged?
I hope this will be fixed with a combination of that PR + this one, but the mention of the camera causing this issue too makes me doubt that... Even if the camera app launched by the attachment menu returned the wrong mime type image/*, I think we're overriding it locally.
In any case, maybe we can mark this as closed and ask everyone to reopen it if the issue appears again after the fixes are published.