[9.x] Avoid throwing on invalid mime-type#42761
Merged
taylorotwell merged 2 commits intoJun 13, 2022
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
league/flysystemversion 3, changed to throw exceptions in places it previously returnednullorfalsewhen a called method failed to execute.As noted by issue #42758 , calling
Illuminate\Filesystem\FilesystemAdapter@mimeTypethrows an exception when a file has a custom extension.This becomes a problem when this method is called within other methods such in:
framework/src/Illuminate/Filesystem/FilesystemAdapter.php
Line 278 in 2bc1802
framework/src/Illuminate/Mail/Attachment.php
Line 98 in 2bc1802
framework/src/Illuminate/Mail/Mailable.php
Line 463 in 2bc1802
Disclaimer: usage on
Illuminate\Filesystem\FilesystemAdapter@responseis changed to be lazily evaluated in PR #42760This PR
Illuminate\Filesystem\FilesystemAdapter@mimeTypeto returnfalse, as per its docblock, when the mime type cannot be detectedthrowconfiguration, when a developer sets it totruean exception will be thrown insteadEDIT
As
league/flysystemchanged the mime type detection behavior on tag 3.0.16, I updated thecomposer.jsonfile to require at least this version.Otherwise tests with prefer-lowest were failing