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

Fix: Prefer inconclusive mimetype over null #1710

Merged

Conversation

GuySartorelli
Copy link
Contributor

This fixes the scenario where detectMimeTypeFromFile() detects an inconclusive mimetype, so we fallback to detectMimeTypeFromPath(), which returns null.

Instead of returning null (which will result in LocalFilesystemAdapter throwing a UnableToRetrieveMetadata exception), we should return the inconclusive result. Valid but inconclusive is better than an exception.

Related issue:

@GuySartorelli
Copy link
Contributor Author

GuySartorelli commented Nov 8, 2023

@frankdejonge Could I bother you to please take a look at this PR? It's causing us some grief and we'd like to know if you will be accepting this pull request (or one like it), or if we will need to handle this scenario in our own application logic.
We're using a fork with this patch applied at the moment, which isn't ideal.

@frankdejonge frankdejonge merged commit 4213068 into thephpleague:3.x Nov 18, 2023
@GuySartorelli GuySartorelli deleted the pulls/3.x/no-null-mimetype branch November 18, 2023 23:10
@GuySartorelli
Copy link
Contributor Author

Thank you!

@driesvints
Copy link
Contributor

This PR seems to have broken the Laravel test suite: laravel/framework#49229

@frankdejonge
Copy link
Member

Sorry about that @driesvints, I've made an effective revert on this while making the PR functionality an opt-in. It's released as 3.23.0

@driesvints
Copy link
Contributor

@frankdejonge thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants