ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

mod_http_upload: missing content types

Open marc0s opened this issue 3 months ago • 3 comments

Some files uploaded via mod_http_upload will have the default Content-Type header value of application/octet-stream because their mapping of extension => mime type is missing from both mod_http_upload.erl and mod_http_fileserver.erl.

We're using the Content-Type header in our client to determine if the referenced file may be previewed in the conversation or just linked to it for the user to download it. When a file whose MIME type is not listed in the modules mentioned above, but it's a media file we want to embed into the conversation, we're unable to do so because it looks like a generic file. This happens with webm audio files, for instance.

To overcome this situation, I'd say we should do one of the following:

  • allow to configure the mappings of extension => mime types in one of the module's configuration in ejabberd.yml
  • create the mapping from the /etc/mime.types (or equivalent) file present in lots (almost all?) of operating systems
  • fetch the IANA mediatypes' list and generate the mapping from there (exhaustive, but I think overkill)

IMHO, the first option is both flexible and enough.

Thoughts on this?

marc0s avatar Nov 06 '25 11:11 marc0s