rust-lang / rust-lang/docs.rs

potential wrong mime types in our storage

Open
#2,050 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-backend C-bug
Dominant language
Rust
Stars
1.2k
Forks
232
Avg merge
11h 35m
Merged PRs (30d)
60

Description

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)
https://github.com/rust-lang/docs.rs/blob/c927eac0497baa99d13e9f58e0666021affb8f68/src/storage/mod.rs#L549-L551

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the discussion in issue #2040 and inspect src/storage/mod.rs around lines 549-551, where the text/plain fallback is referenced. Review how magic and mime_guess were used for crate uploads and how MIME data reaches S3 or the database. Done is not defined yet; the issue needs a decision on the fallback and on handling potentially invalid MIME types from older crates.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.