Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Internal server error when uploading encrypted image with correct mimetype #7126

Closed
krille-chan opened this issue Mar 23, 2020 · 2 comments
Closed
Labels
A-Media-Repository Uploading, downloading images and video, thumbnailing

Comments

@krille-chan
Copy link

Description

If the client tries to upload an encrypted image with the Content-Type for example "image/jpeg", the server response with "Internal server error". For encrypted images I need to change the Content-Type to "application/octet-stream".

Steps to reproduce

  • Build a fancy Matrix client with file encryption
  • Encrypt an image file
  • Upload the image with the Content-Type of the unencrypted image mimetype

Expected:
The server recognized that the file is encrypted and handles it like a blob and does not respond with an internal server error.

Actual:
Can't upload the image without an internal server error.

Version information

If not matrix.org:

  • Version: Can tell you this later today

  • Install method: Docker, more information will come later today

  • Platform: Debian, more information will come later today
@clokep
Copy link
Member

clokep commented Apr 2, 2020

@ChristianPauly Is this a client that you're developing?

Taking a look at the spec for encrypted attachments it doesn't seem to specify what the mime type should be in that case.

My guess is that this is breaking when attempting to generate the thumbnail for unknown data, that seems like not great of Synapse. It would be interesting to see the stack trace in the Synapse logs when this happens.

@clokep clokep added the A-Media-Repository Uploading, downloading images and video, thumbnailing label Apr 2, 2020
@clokep
Copy link
Member

clokep commented Apr 2, 2020

A bit more thoughts:

  • Including the actual content type of encrypted is a metadata leak.
  • There isn't a recommendation for what should be used for the content type, but a octet stream is reasonable, application/x-riot-encrypted is another idea that came up. It is also possible to not provide a content type.
  • The 500 error seems to be a duplicate of Errors from thumbnailing due to bad format give a 500 #3763

I'm going to close this as a duplicate, but please shout if this seems different.

@clokep clokep closed this as completed Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Media-Repository Uploading, downloading images and video, thumbnailing
Projects
None yet
Development

No branches or pull requests

2 participants