Service file.mime_type.guesser fails to find MIME type for filenames containing .0.

Created on 11 December 2024, 10 days ago

Problem/Motivation

When passing a filename such as foo.0.bar.baz.pdf the MIME Type Guesser should be able to return the correct MIME type for this file extension, application/pdf. Instead, it returns application/octet-stream.

There is a control flow bug in ExtensionMimeTypeGuesser::guessMimeType , in which a while loop is exited prematurely because of a "0" in the filename that will evaluate to FALSE.

Instead of exiting, the loop should continue until it reaches the file extension, "pdf" in this case. The string "pdf" would successfully be matched to the correct application/pdf MIME type.

Steps to reproduce

Upload a file with a name containing a zero between periods, e.g. foo.0.bar.baz.pdf.

Proposed resolution

Revise the guessMimeType method to fully iterate over the exploded file name parts.

Remaining tasks

Revise the guessMimeType method. Develop tests.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

TBD.

🐛 Bug report
Status

Active

Version

10.3

Component

file system

Created by

jamestarleton New York, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024