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

[Mime] fixed wrong mimetype #32986

Merged
merged 1 commit into from
Aug 7, 2019
Merged

[Mime] fixed wrong mimetype #32986

merged 1 commit into from
Aug 7, 2019

Conversation

rjwebdev
Copy link
Contributor

@rjwebdev rjwebdev commented Aug 6, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #32816
License MIT

When creating a datapart from an odt file (and some other extensions), the explode function for the picked mimetype gives a wrong result since there's no application/ prefix for the first mimetype of this extension.

In this PR, all mimetypes without a prefix are removed.

@nicolas-grekas
Copy link
Member

The list there is automatically computed so we cannot patch it like that.
Instead, we should make the code that calls explode() handle the situation.

@rjwebdev
Copy link
Contributor Author

rjwebdev commented Aug 6, 2019

So I better revert my changes and catch this error in the DataPart constructor?

@nicolas-grekas
Copy link
Member

yes please

@fabpot
Copy link
Member

fabpot commented Aug 6, 2019

Wouldn't it be better to change the code that generates the list to exclude non valid values?

@rjwebdev
Copy link
Contributor Author

rjwebdev commented Aug 6, 2019

And where are these lists generated? Should this code be changed or should a check be added on the DataPart::fromPath function?

@fabpot
Copy link
Member

fabpot commented Aug 6, 2019

Resources/bin/update_mime_types.php

@rjwebdev
Copy link
Contributor Author

rjwebdev commented Aug 7, 2019

I removed the od* file extensions from the generator script.

@fabpot
Copy link
Member

fabpot commented Aug 7, 2019

Thank you @rjwebdev.

@fabpot fabpot merged commit e1722c5 into symfony:4.3 Aug 7, 2019
fabpot added a commit that referenced this pull request Aug 7, 2019
This PR was squashed before being merged into the 4.3 branch (closes #32986).

Discussion
----------

[Mime] fixed wrong mimetype

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32816
| License       | MIT

When creating a datapart from an odt file (and some other extensions), the explode function for the picked mimetype gives a wrong result since there's no `application/` prefix for the first mimetype of this extension.

In this PR, all mimetypes without a prefix are removed.

Commits
-------

e1722c5 [Mime] fixed wrong mimetype
@rjwebdev rjwebdev deleted the datapart-frompath branch August 7, 2019 10:05
@fabpot fabpot mentioned this pull request Aug 26, 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

4 participants