Skip to content

potential wrong mime types in our storage #2050

Open
@syphar

Description

@syphar

coming from #2040 and the comments by @Nemo157

The question I have is how did an invalid mimetype get into S3, and I probably found the answer with a little more looking, it's an old crate built in 2017 back when https://docs.rs/magic was used for mimetype detection, I'm not surprised it may have put some invalid data into the database back then.

and

(This does make me question our current default of text/plain when mime detection fails while adding a file though)

docs.rs/src/storage/mod.rs

Lines 549 to 551 in c927eac

let mime = mime_guess::from_path(file_path.as_ref())
.first_raw()
.unwrap_or("text/plain");

We might have:

  • wrong mime-types / invalid data for old crates, when magic was used.
  • a text/plain default set when mime_guess doesn't give us anything, where application/octet-stream might be the better default? ( to be discussed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-backendArea: Webserver backendC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions