-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Make MimeTypeExtensionGuesser case insensitive #31084
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
src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php
Outdated
Show resolved
Hide resolved
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 needs a patch for master as well, where |
@vermeirentony can you add a test case please? |
@nicolas-grekas |
@vermeirentony Thanks for the contribution, I think by testcase Nicolas was meaning a test directly in the framework with PHPUnit, could you do that please ? |
@Simperfit sure, will write one later today |
@nicolas-grekas I just added the unit test |
@vermeirentony Can you squash your commits before merging? Right now, you've used 2 different identities for your commits. You probably need to keep the one here on Github. |
@fabpot squashed the 3 commits into one |
…itive (vermeirentony) This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Make MimeTypeExtensionGuesser case insensitive | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Some mime types have a camelCase word in them. The Apache HTTPD project list items are all lower case. So I suggest making the $mimeType string lowercase while checking the array key. That way, we can keep the list in sync. Example: xlsm file mime type is `application/vnd.ms-excel.sheet.macroEnabled.12` The key that matches the xlsm extension in the `$defaultExtensions` array is `application/vnd.ms-excel.sheet.macroenabled.12` Example xlsm file: https://github.com/vermeirentony/xlsm-example Commits ------- e294ee6 Make MimeTypeExtensionGuesser case insensitive
Thank you @vermeirentony |
Some mime types have a camelCase word in them.
The Apache HTTPD project list items are all lower case.
So I suggest making the $mimeType string lowercase while checking the array key.
That way, we can keep the list in sync.
Example: xlsm file mime type is
application/vnd.ms-excel.sheet.macroEnabled.12
The key that matches the xlsm extension in the
$defaultExtensions
array isapplication/vnd.ms-excel.sheet.macroenabled.12
Example xlsm file:
https://github.com/vermeirentony/xlsm-example