-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canonical types and aliases #101
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,30 +28,30 @@ | |
Marcel::MimeType.extend "application/vnd.ms-powerpoint.template.macroenabled.12", parents: "application/vnd.openxmlformats-officedocument.presentationml.presentation" | ||
Marcel::MimeType.extend "application/vnd.ms-powerpoint.slideshow.macroenabled.12", parents: "application/vnd.openxmlformats-officedocument.presentationml.presentation" | ||
|
||
Marcel::MimeType.extend "application/vnd.apple.pages", extensions: %w( pages ), parents: "application/zip" | ||
Marcel::MimeType.extend "application/vnd.apple.numbers", extensions: %w( numbers ), parents: "application/zip" | ||
Marcel::MimeType.extend "application/vnd.apple.keynote", extensions: %w( key ), parents: "application/zip" | ||
Marcel::MimeType.extend "application/vnd.apple.pages", parents: "application/zip" | ||
Marcel::MimeType.extend "application/vnd.apple.numbers", parents: "application/zip" | ||
Marcel::MimeType.extend "application/vnd.apple.keynote", parents: "application/zip" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Including the file extensions suggests they're being extended, but they aren't. Omit them to clarify that we're changing the parent. |
||
|
||
Marcel::MimeType.extend "audio/aac", extensions: %w( aac ), parents: "audio/x-aac" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This style of "overriding" a MIME type results in .aac files resolving to Replaced with |
||
Marcel::MimeType.extend("audio/ogg", extensions: %w( ogg oga ), magic: [[0, 'OggS', [[29, 'vorbis']]]]) | ||
# Upstream aliases to application/x-x509-cert. Override with a ;format=pem subtype. | ||
Marcel::MimeType.extend "application/x-x509-ca-cert", magic: [[0, '-----BEGIN CERTIFICATE-----']], extensions: %w( pem ), parents: "application/x-x509-cert;format=pem" | ||
|
||
Marcel::MimeType.extend "image/vnd.dwg", magic: [[0, "AC10"]] | ||
Marcel::MimeType.extend "audio/mpc", magic: [[0, "MPCKSH"]], extensions: %w( mpc ) | ||
Marcel::MimeType.extend "audio/ogg", extensions: %w( ogg oga ), magic: [[0, 'OggS', [[29, 'vorbis']]]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really odd one, breaking the MIME hierarchy entirely and using the same magic matcher as |
||
Marcel::MimeType.canonicalize "audio/aac", instead_of: "audio/x-aac" | ||
Marcel::MimeType.canonicalize "audio/flac", instead_of: "audio/x-flac" | ||
Marcel::MimeType.canonicalize "audio/x-wav", instead_of: "audio/vnd.wave" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, change the canonical type rather than introducing misleading MIME subtypes. |
||
|
||
Marcel::MimeType.extend "application/x-x509-ca-cert", magic: [[0, '-----BEGIN CERTIFICATE-----']], extensions: %w( pem ), parents: "application/x-x509-cert;format=pem" | ||
Marcel::MimeType.extend "image/vnd.dwg", magic: [[0, "AC10"]] | ||
|
||
Marcel::MimeType.extend "image/avif", magic: [[4, "ftypavif"]], extensions: %w( avif ) | ||
Marcel::MimeType.extend "image/heif", magic: [[4, "ftypmif1"]], extensions: %w( heif ) | ||
Marcel::MimeType.extend "image/heic", magic: [[4, "ftypheic"]], extensions: %w( heic ) | ||
Marcel::MimeType.extend "image/avif", magic: [[4, "ftypavif"]] | ||
Marcel::MimeType.extend "image/heif", magic: [[4, "ftypmif1"]] | ||
Marcel::MimeType.extend "image/heic", magic: [[4, "ftypheic"]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These matchers are already in the Tika data. Unclear whether these are simply defunct and can be removed. |
||
|
||
Marcel::MimeType.extend "image/x-raw-sony", extensions: %w( arw ), parents: "image/tiff" | ||
Marcel::MimeType.extend "image/x-raw-canon", extensions: %w( cr2 crw ), parents: "image/tiff" | ||
Marcel::MimeType.extend "image/x-raw-canon", parents: "image/tiff" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop duplicate extensions. |
||
|
||
Marcel::MimeType.extend "video/mp4", magic: [[4, "ftypisom"], [4, "ftypM4V "]], extensions: %w( mp4 m4v ) | ||
|
||
Marcel::MimeType.extend "audio/flac", magic: [[0, 'fLaC']], extensions: %w( flac ), parents: "audio/x-flac" | ||
Marcel::MimeType.extend "audio/x-wav", magic: [[0, 'RIFF', [[8, 'WAVE']]]], extensions: %w( wav ), parents: "audio/vnd.wav" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched to |
||
Marcel::MimeType.extend "audio/mpc", magic: [[0, "MPCKSH"]], extensions: %w( mpc ) | ||
|
||
Marcel::MimeType.extend "font/ttf", magic: [[0, "\x00\x01\x00\x00"]], extensions: %w( ttf ttc ) | ||
Marcel::MimeType.extend "font/otf", magic: [[0, "OTTO"]], extensions: %w( otf ), parents: "font/ttf" | ||
Marcel::MimeType.extend "application/vnd.adobe.flash.movie", magic: [[0, "FWS"], [0, "CWS"]], extensions: %w( swf ) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all pretty grotesque. Trying to limit the API footprint and not mess with the carefully tuned data tables.