mime: wrong extensions list for content type "image/jpeg" when using built-in types #36524
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
Output(Some values sanitized with "xyz".)
What did you do?
I was trying to retrieve file extensions for the content type "image/jpeg" with
mime.ExtensionsByType("image/jpeg")
.https://play.golang.org/p/gfVzW9oAdiq
What did you expect to see?
On systems where none of the following files are present, the built-in types list is used according to the documentation.
The built-in list can be viewed here: https://golang.org/src/mime/type.go#L59
It contains two entries for "image/jpeg". So I would expect to get these two entries as result of
mime.ExtensionsByType("image/jpeg")
:[]string{".jpg", ".jpeg"}
There is also a code comment in that mentions this exact case: https://golang.org/src/mime/type.go#L19
What did you see instead?
On my machine either
[]string{".jpg"}
or[]string{".jpeg"}
at random. On the playground always[]string{".jpeg"}
.Here is a test case for the issue that can be run in "mime/type_test.go":
The text was updated successfully, but these errors were encountered: