-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mime] switching source of mime types from Apache to "MIME-db" #37422
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
Conversation
desarrolla2
commented
Jun 26, 2020
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | no |
Deprecations? | no |
Tickets | Fix #37412 |
License | MIT |
Doc PR | no |
I preferred to use the "v1.44.0" tag instead of master because they recommend it, since there may be json format changes in the future. Maybe you prefer that I use master branch and this script fails, if format changes. |
Great! Can you apply fabbot's patch? Also, can you run the script to see the diff with what we have now? |
'audio/mp2' => ['mp2'], | ||
'audio/mp3' => ['mp3', 'mpga'], | ||
'audio/mp4' => ['m4a', 'mp4a', 'f4a'], | ||
'audio/mpeg' => ['mp3', 'mpga', 'mp2', 'mp2a', 'm2a', 'm3a'], | ||
'audio/mpeg' => ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'], |
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.
related to #37389, mp3 should be first?
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.
Yes, it's the most common format. You can also add mp1
like defined here (page3).
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.
@YaFou could you please report this to https://github.com/jshttp/mime-db? Maybe send them a PR also?
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.
I will do that this evening!
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.
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.
@YaFou can you revert this change, maybe adding a comment like // mp3 should be first
same in other places where I commented about ordering?
that'd allow unlocking this PR
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.
I meant @desarrolla2 sorry
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.
@nicolas-grekas do you want that:
a) I put the extensions in the order that you comment at MimeTypes.php
b) I update the script update_mime_types.php to force that order after download sources
c) I add comments with your suggestions at MimeTypes.php
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.
I think b) would be good. Then the comments would be found in update_mime_types.php only.
@@ -1460,7 +1587,7 @@ public function guessMimeType(string $path): ?string | |||
'text/x-lua' => ['lua'], | |||
'text/x-lyx' => ['lyx'], | |||
'text/x-makefile' => ['mk', 'mak'], | |||
'text/x-markdown' => ['md', 'mkd', 'markdown'], | |||
'text/x-markdown' => ['mkd', 'md', 'markdown'], |
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.
if the 1st is the most used, then md
should be first?
does the order mean something in the source db?
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.
For reference, the source DB uses this preference for merging the multiple sources:
// source preference (least -> most)
var preference = ['nginx', 'apache', undefined, 'iana']
@@ -334,18 +368,23 @@ public function guessMimeType(string $path): ?string | |||
'application/vnd.antix.game-component' => ['atx'], | |||
'application/vnd.appimage' => ['appimage'], | |||
'application/vnd.apple.installer+xml' => ['mpkg'], | |||
'application/vnd.apple.keynote' => ['key'], | |||
'application/vnd.apple.keynote' => ['keynote', 'key'], |
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.
key
should be first ?
Thanks for working on this. |
should i rebase the commit to improve the history? |
@desarrolla2 yes please |
1fcb68b
to
50c18e5
Compare
@@ -2377,20 +2568,25 @@ public function guessMimeType(string $path): ?string | |||
'msf' => ['application/vnd.epson.msf'], | |||
'msg' => ['application/vnd.ms-outlook'], | |||
'msh' => ['model/mesh'], | |||
'msi' => ['application/x-msdownload', 'application/x-msi'], | |||
'msi' => ['application/octet-stream', 'application/x-msdownload', 'application/x-msi'], |
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.
I've checked the source and I think we should always list 'application/octet-stream'
last.
Alternatively, we should just skip it. The reason is that we already fallback to 'application/octet-stream'
by default in DataPart
. For sure, listing it first is going to be a regression.
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.
@nicolas-grekas you prefer that:
a) I put 'application/octet-stream' last.
b) I skip 'application/octet-stream'
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.
Skipping would be best IMHO
f727277
to
ea2dd96
Compare
ab5f2c6
to
c74edb5
Compare
@desarrolla2 I've fixed your last commit. |
c74edb5
to
ebea452
Compare
Thank you @desarrolla2. |