Problem/Motivation
When guessing MIME type for files stored in remote file systems, for example dummy-remote://test.png,MIME type returned is always application/octet-stream.
That's because MimeTypeGuesser::guess always try to replace the $path passed in with its realpath.
But remote stream wrapper return NULL for ->realpath(), hence the default MIME type applies.
Proposed resolution
Replace the $path only if a sensible realpath is returned by the wrapper.
Remaining tasks
review
User interface changes
none
API changes
none
Data model changes
none
Comments
Comment #2
mondrakePatch
Comment #4
twistor commentedThis should check !== FASLE, since realpath() could return '0'.
According to
StreamWrapperInterface::realpath(), it should return FALSE, not NULL if unsupported.Comment #5
mondrakeThank you @twistor. Done #4.
Comment #6
twistor commentedComment #7
alexpottCommitted and pushed 4e547f5246e09ad41ce5caba8ead3bf4a7baec59 to 8.2.x and 3de9785 to 8.1.x. Thanks!
Nice find and fix. Committing to both branches as the bug fix is patch eligible.