Problem/Motivation
When uploading a file with "0" (zero) as a part of its name, the file is marked incorrectly as application/octet-stream instead of its real mimetype.
This is because when the file name contains a "0" (zero) between dots, guessMimeType() from the ExtensionMimeTypeGuesser class returns NULL prematurely.
Steps to reproduce
- Have a file media entity.
- Upload a file named foo.0.zip. (No need to save the media entity.)
- Go to the Content > Files list.
- The uploaded file is marked as application/octet-stream instead of application/zip.
Proposed resolution
Fix the "while" condition in guessMimeType to exit only if array_shift returns NULL.
Remaining tasks
- Review the patch.
- Merge.
- Apply the patch to the latest core versions.
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.