Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Querying file extension by the MIME type may return multiple extensions

Open
#382 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
backend

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.

Description

When multiple extensions have the same MIME type, the code here can become problematic:

https://github.com/posit-dev/connectapi/blob/67a52e20e147a9f1102ac73c73370c7498913a47/R/thumbnail.R#L53-L58

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):

https://github.com/posit-dev/connectapi/blob/67a52e20e147a9f1102ac73c73370c7498913a47/tests/testthat/test-thumbnail.R#L35

Dominant language
R
Stars
54
Forks
27
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from posit-dev/connectapi

All issues in posit-dev/connectapi

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.