Skip to content

finfo returns wrong mime type for woff/woff2 files #8805

Closed
@kojot1234

Description

@kojot1234

Description

Uploaded woff/woff2 return incorrect mime type.

The following code:

// $path is a content of an uploaded woff or woff2 file

$finfo = new \finfo(\FILEINFO_MIME_TYPE));
$mimeType = $finfo->file($path); // returns "application/octet-stream"
echo $mimeType;

Resulted in this output:

returns "application/octet-stream"

But I expected this output instead:

expected result is: "font/woff"

Mime type has been fixed in libmagic/file in version 5.42.

file/file@7a821ae

PHP Version

8.1.7

Operating System

Alpine 3.16

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions