Skip to content
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

[HttpFoundation] Make MimeTypeExtensionGuesser case insensitive #31084

Merged
merged 1 commit into from Apr 17, 2019

Conversation

Projects
None yet
6 participants
@vermeirentony
Copy link
Contributor

vermeirentony commented Apr 12, 2019

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

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

@ro0NL

This comment has been minimized.

Copy link
Contributor

ro0NL commented Apr 12, 2019

this needs a patch for master as well, where MimeTypes is a new class.

@nicolas-grekas nicolas-grekas added this to the next milestone Apr 14, 2019

@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Apr 14, 2019

@vermeirentony can you add a test case please?

@nicolas-grekas nicolas-grekas modified the milestones: next, 3.4 Apr 14, 2019

@vermeirentony

This comment has been minimized.

Copy link
Contributor Author

vermeirentony commented Apr 14, 2019

@Simperfit

This comment has been minimized.

Copy link
Contributor

Simperfit commented Apr 15, 2019

@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 ?

@vermeirentony

This comment has been minimized.

Copy link
Contributor Author

vermeirentony commented Apr 15, 2019

@Simperfit sure, will write one later today

@vermeirentony

This comment has been minimized.

Copy link
Contributor Author

vermeirentony commented Apr 15, 2019

@nicolas-grekas I just added the unit test

@ro0NL

ro0NL approved these changes Apr 15, 2019

@fabpot

fabpot approved these changes Apr 15, 2019

@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Apr 15, 2019

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

@vermeirentony vermeirentony force-pushed the vermeirentony:patch-1 branch from 6a884c2 to e294ee6 Apr 16, 2019

@vermeirentony

This comment has been minimized.

Copy link
Contributor Author

vermeirentony commented Apr 16, 2019

@fabpot squashed the 3 commits into one

@fabpot fabpot merged commit e294ee6 into symfony:3.4 Apr 17, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot pushed a commit that referenced this pull request Apr 17, 2019

bug #31084 [HttpFoundation] Make MimeTypeExtensionGuesser case insens…
…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
@nicolas-grekas

This comment has been minimized.

Copy link
Member

nicolas-grekas commented Apr 17, 2019

Thank you @vermeirentony

This was referenced Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.