Commit Graph

68 Commits

Author SHA1 Message Date
Robert Lützner 2bd85df383
Add missing MIME types for comicbook formats (#11010)
* 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
2024-02-15 23:15:14 +01:00
felix920506 aaa9345a53
Correct m4b mimetype (#10980) 2024-02-10 21:39:30 -07:00
Bond_009 60f41b80f6 Verify ContentType of uploaded images 2023-02-16 15:08:01 +01:00
Bond_009 b366dc2e6e Use ArgumentException.ThrowIfNullOrEmpty 2022-12-07 16:43:59 +01:00
Bond_009 dc222b75c5 Remove incorrect mime type image/jpg 2022-01-04 10:40:16 +01:00
Cody Robibero 6804624c15 Add image/jpg to extension lookup 2021-12-25 11:41:39 -07:00
Bond_009 7ee96a59d3 Use correct jpeg MIME type
image/jpg isn't a valid MIME type
2021-12-12 02:07:35 +01:00
Ahmed Rafiq 0e491025ae
Refactor MimeTypes.ToExtension()
Co-authored-by: Cody Robibero <cody@robibe.ro>
2021-12-04 21:13:18 +06:00
Ahmed Rafiq 40e05a7993 Update documentation 2021-12-04 21:06:51 +06:00
Ahmed Rafiq 6193fdea69 Use MimeTypes package to determine MIME type
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
2021-12-04 20:08:16 +06:00
Bond_009 257e1be95f Fix some warnings 2021-11-16 16:31:57 +01:00
Bond_009 5fd315b17c Address comments 2021-09-24 20:15:46 +02:00
Bond_009 13fbfe6091 Target net6.0 2021-09-24 20:15:46 +02:00
Bond_009 a6d1e542e6 Reduce allocations 2021-09-19 20:53:31 +02:00
Bond_009 141efafd3d Enable TreatWarningsAsErrors for MediaBrowser.Model 2021-02-20 23:29:33 +01:00
crobibero d5e2369dd6 Fix nullability errors in MediaBrowser.Model 2020-11-13 09:36:17 -07:00
crobibero 01355e0498 Fix nullability errors in Jellyfin.Api (part 1) 2020-11-13 09:04:31 -07:00
Bill Thornton b065f5db1d Fix aac mime-type 2020-09-04 17:41:31 -04:00
Bond_009 7439e095e2 Merge branch 'master' into nullable3 2020-05-27 20:49:18 +02:00
artiume ae4c407b6d
Add .edl Mimetype 2020-05-20 16:46:33 -04:00
artiume a765272c17
Update MimeTypes.cs 2020-05-15 09:38:26 -04:00
artiume 9ed8c6cb11
Add opf mimetype 2020-05-15 07:59:46 -04:00
artiume 3e14b1b50f
Remove ogg video mimetype 2020-05-07 15:58:20 -04:00
artiume 1388464329
Update MimeTypes.cs 2020-05-06 08:23:56 -04:00
artiume 1058c80a41
Update MediaBrowser.Model/Net/MimeTypes.cs 2020-05-06 07:45:40 -04:00
artiume 0aff46631f
Update MediaBrowser.Model/Net/MimeTypes.cs
Co-authored-by: dkanada <dkanada@users.noreply.github.com>
2020-05-06 07:38:19 -04:00
Mark Monteiro 432aae0fcc Add missing comma 2020-05-05 11:17:03 -04:00
artiume 183514ebe2
add azw3 2020-05-05 07:25:32 -04:00
artiume 25651362bf
Update MimeTypes.cs 2020-05-04 12:13:50 -04:00
artiume 675cbd8a16
Update MimeTypes.cs 2020-05-03 18:23:25 -04:00
randrey 2e10d385f0 Add mime type for .mpegts files. 2020-04-17 23:11:52 -07:00
randrey 156998dd83 Add mime types for ape and wv files. 2020-04-17 22:25:54 -07:00
Bond_009 30ce346f34 Enable nullabe reference types for MediaBrowser.Model 2020-04-05 18:10:56 +02:00
Shawmon 8630d18372 add wasm mimetype 2020-03-17 11:49:32 +08:00
Bond_009 07cc4be6a7 Fix some warnings
* Add analyzers to MediaBrowser.XbmcMetadata
* Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata
* Add analyzers to MediaBrowser.WebDashboard
* Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard
* Disable SA1600 in favor of CS1591
2020-02-23 12:11:43 +01:00
Bond_009 f47ad85011 Fix warnings MediaBrowser.Model 2020-02-04 01:49:27 +01:00
Bond-009 fdbb329118 Remove StringHelper functions 2020-01-09 17:07:13 +01:00
Bill Thornton 3a600687ea Restore flac mime type 2019-09-01 01:15:34 -04:00
Bond-009 8b1bd7ac6b Use a dictionary to look up mimetypes 2019-07-28 20:20:03 +02:00
Bond_009 a709cbdc64 Fix more analyzer warnings 2019-01-27 12:12:44 +01:00
Erwin de Haan 38f96af079 Reformat JustAMan review pt2 changes
Refs #575
2019-01-17 20:24:39 +01:00
Erwin de Haan e867446437 ReSharper format: conform inline 'out' parameters. 2019-01-13 21:46:33 +01:00
Erwin de Haan 65bd052f3e ReSharper conform to 'var' settings 2019-01-13 21:37:13 +01:00
Erwin de Haan 8f41ba4d3a Find+Sed BOM removal *.cs: MediaBrowser.LocalMetadata-MediaBrowser.Model 2019-01-13 21:02:23 +01:00
Erwin de Haan 1a4b271314 Visual Studio Reformat: MediaBrowser.Model 2019-01-13 20:26:15 +01:00
Erwin de Haan ec1f5dc317 Mayor code cleanup
Add Argument*Exceptions now use proper nameof operators.

Added exception messages to quite a few Argument*Exceptions.

Fixed rethorwing to be proper syntax.

Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling)

Added some TODOs to log certain exceptions.

Fix sln again.

Fixed all AssemblyInfo's and added proper copyright (where I could find them)

We live in *current year*.

Fixed the use of braces.

Fixed a ton of properties, and made a fair amount of functions static that should be and can be static.

Made more Methods that should be static static.

You can now use static to find bad functions!

Removed unused variable. And added one more proper XML comment.
2019-01-10 20:38:53 +01:00
Joshua M. Boniface 4ab82f7436 Merge pull request #488 from sparky8251/fix-mimetype-formatting
Fix odd formatting in MimeType.cs
2019-01-07 11:25:43 -05:00
Sparky ae4a82570c Fixed odd formatting in MimeType.CS
Think there might have been a mismatch between tabs and spaces. All spaces now.
2019-01-07 11:23:11 -05:00
Sparky 1f5b9a04fb Open log files in browser again
Fixes #485

Looks like we regressed and now only the .txt logs would open in the browser when clicked. 

Added in MimeType handler for .log files. Problem solved.
2019-01-07 11:19:59 -05:00
Andrew Rabert a86b71899e Add GPL modules 2018-12-27 18:27:57 -05:00