Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

desarrolla2
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? no
Tickets Fix #37412
License MIT
Doc PR no

@desarrolla2
Copy link
Contributor Author

desarrolla2 commented Jun 26, 2020

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.

@fabpot
Copy link
Member

fabpot commented Jun 26, 2020

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'],
Copy link
Member

@nicolas-grekas nicolas-grekas Jun 26, 2020

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?

Copy link
Contributor

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).

Copy link
Member

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?

Copy link
Contributor

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!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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

Copy link
Member

@nicolas-grekas nicolas-grekas Jun 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant @desarrolla2 sorry

Copy link
Contributor Author

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

Copy link
Member

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'],
Copy link
Member

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?

Copy link
Member

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'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key should be first ?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jun 26, 2020

Thanks for working on this.
About my comments above related to ordering, maybe we should send them to the upstream db?

@nicolas-grekas nicolas-grekas added this to the next milestone Jun 30, 2020
@desarrolla2
Copy link
Contributor Author

should i rebase the commit to improve the history?

@stof
Copy link
Member

stof commented Jul 3, 2020

@desarrolla2 yes please

@desarrolla2 desarrolla2 force-pushed the ticket_37412 branch 2 times, most recently from 1fcb68b to 50c18e5 Compare July 4, 2020 07:35
@@ -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'],
Copy link
Member

@nicolas-grekas nicolas-grekas Jul 4, 2020

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.

Copy link
Contributor Author

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'

Copy link
Member

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

@fabpot fabpot force-pushed the ticket_37412 branch 2 times, most recently from ab5f2c6 to c74edb5 Compare July 15, 2020 07:10
@fabpot
Copy link
Member

fabpot commented Jul 15, 2020

@desarrolla2 I've fixed your last commit.

@nicolas-grekas
Copy link
Member

Thank you @desarrolla2.

@nicolas-grekas nicolas-grekas merged commit 5a61446 into symfony:master Jul 15, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider using another source for MIME types
8 participants