Although image/jpg is not a registered MIME type (RFC 2046 specifies
image/jpeg), several external providers return image/jpg as the
Content-Type for JPEG images:
- TMDb API (thumbnail/episode images)
- Schedules Direct EPG
- Various other metadata providers
Without this mapping, Jellyfin throws ArgumentException:
'Unable to determine image file extension from mime type image/jpg'
This causes library scans to fail when saving episode thumbnails
and other images from these providers, leading to repeated scan
failures and cancelled library scans.
PR #7052 previously added this but it was lost during the migration
to FrozenDictionary. Issue #13568 reports the same bug in 10.10+.
Fixes: jellyfin/jellyfin#13568
Related: jellyfin/jellyfin#7050, jellyfin/jellyfin#7052
* Correct MIME types for comicbook file extensions
cb7, cba, cbr, cbt and cbz all refer to different types of digital
comicbooks. The last letter of the extension indicates the compression
algorithm that was used: 7zip, arc, rar, tar or zip.
All these filetypes used to have the `application/x-cbr` MIME type
assigned to them. However, that has since been deprecated and was
replaced with
- `application/vnd.comicbook-rar` for rar compressed files and
- `application/vnd.comicbook+zip` for rar compressed files.
Only these two are officially listed by IANA
https://www.iana.org/assignments/media-types/application/vnd.comicbook+zip
. cbr and cbz are by far the most common file extensions for comicbooks.
There's no official MIME type for cb7, cba or cbt files. However, with
rar being a proprietary compression algorithm, FOSS applications will
often refuse to handle files that identify themselves as
`application/x-cbr`, so I decided to assign extension specific MIME
types to them. I've seen these being used by other applications,
specifically comic book readers.
I've read through the docs on iana.org, but haven't figured out why they
chose `-rar`, but `+zip`.
* Add conversions from MIME type to file extensions for comicbook formats
cb7, cba, cbr, cbt and cbz all refer to different types of digital
comicbooks. The last letter of the extension indicates the compression
algorithm that was used: 7zip, arc, rar, tar or zip.
All these filetypes used to have the `application/x-cbr` MIME type
assigned to them. However, that has since been deprecated and was
replaced with
- `application/vnd.comicbook-rar` for rar compressed files and
- `application/vnd.comicbook+zip` for rar compressed files.
Only these two are officially listed by IANA
https://www.iana.org/assignments/media-types/application/vnd.comicbook+zip
. cbr and cbz are by far the most common file extensions for comicbooks.
There's no official MIME type for cb7, cba or cbt files. However, with
rar being a proprietary compression algorithm, FOSS applications will
often refuse to handle files that identify themselves as
`application/x-cbr`, so I decided to assign extension specific MIME
types to them. I've seen these being used by other applications,
specifically comic book readers.
* Update CONTRIBUTORS.md
This simplifies the code since we don't have to keep large mappings of extensions and MIME types.
We still keep the ability to override the mappings for:
- filling in entries not present in the package, for e.g. ".azw3"
- picking preferred extensions, for e.g. MimeTypes provides ".conf" as a possible extionsion for "text/plain", and while that is correct, ".txt" would be preferrable
- compatibility reasons