element-x-android icon indicating copy to clipboard operation
element-x-android copied to clipboard

Multiple instances of wrong MIME type in file uploads

Open syldrathecat opened this issue 1 year ago • 3 comments

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

syldrathecat avatar Nov 08 '24 22:11 syldrathecat

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

masterflitzer avatar Jan 14 '25 17:01 masterflitzer

Here the same on EXA 25.02.0

xundeenergie avatar Feb 16 '25 14:02 xundeenergie

Can we close it since https://github.com/matrix-org/matrix-rust-sdk/pull/4987 is merged?

Hywan avatar May 08 '25 06:05 Hywan

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.

jmartinesp avatar May 13 '25 15:05 jmartinesp