posit-dev / posit-dev/connectapi
Querying file extension by the MIME type may return multiple extensions
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 54
- Forks
- 27
- Avg merge
- 1d 3m
- Merged PRs (30d)
- 1
Description
When multiple extensions have the same MIME type, the code here can become problematic:
For example, image/jpeg currently corresponds to four extension in the dev version of the mime package:
library(mime)
mimemap[mimemap == 'image/jpeg']
jfif jpe jpeg jpg
"image/jpeg" "image/jpeg" "image/jpeg" "image/jpeg"
That means the test here will be broken (since it assumes the first extension to be .jpeg, which has become .jfif in the dev version of mime):
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in R/thumbnail.R at the MIME-to-extension lookup and read tests/testthat/test-thumbnail.R, especially the test that assumes a particular JPEG extension. Reproduce the behavior with the current mime package, then establish a test expectation that does not depend on extension ordering and run the thumbnail tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100