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

vermeirentony
Copy link
Contributor

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

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

@ro0NL
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
Copy link
Member

@vermeirentony can you add a test case please?

@nicolas-grekas nicolas-grekas modified the milestones: next, 3.4 Apr 14, 2019
@vermeirentony
Copy link
Contributor Author

@nicolas-grekas
test case (3.4) can be found on https://github.com/vermeirentony/mimetype-testcase

@Simperfit
Copy link
Contributor

@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
Copy link
Contributor Author

@Simperfit sure, will write one later today

@vermeirentony
Copy link
Contributor Author

@nicolas-grekas I just added the unit test

@fabpot
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
Copy link
Contributor Author

@fabpot squashed the 3 commits into one

@fabpot fabpot merged commit e294ee6 into symfony:3.4 Apr 17, 2019
fabpot pushed a commit that referenced this pull request Apr 17, 2019
…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
Copy link
Member

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants