Open RyanGaudion opened 3 years ago
image/jpeg
is the correct mime type. See https://datatracker.ietf.org/doc/html/rfc2158#section-3.1
That said,while we only support one mime type per extension, we do support multiple mime types pointing to the same extension. So while MimeTypeMap.GetMimeType("jpg")
will always return image/jpeg
, we can support both MimeTypeMap.GetExtension("image/jpeg")
and MimeTypeMap.GetExtension("image/jpg")
both returning .jpg
.
To do this, instead of adding a mapping for jpg
to image/jpg
you need to add the reverse mapping (see end of list). I believe when using a manual reverse mapping all of the mappings must be specified, so to get what you want you'll need to add
{"image/jpg", ".jpg"},
{"image/jpeg", ".jpg"},
Then you can lookup the extension by either mime type and it'll maintain backwards compatibility.
If I may, I think the changes submitted by @RyanGaudion still need to be merged in as I'm also getting an exception when trying to get file extension for mime type "image/jpg"
MimeTypeMap.GetExtension("image/jpg") - throws an error when it shouldn't