Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293850

ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip

$
0
0

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

  1. Have a file media entity.
  2. Upload a file named foo.0.zip. (No need to save the media entity.)
  3. Go to the Content > Files list.
  4. 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

  1. Review the patch.
  2. Merge.
  3. Apply the patch to the latest core versions.

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet


Viewing all articles
Browse latest Browse all 293850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>