Skip to content

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

Closed

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

Activity

  1. cmb69 commented on Jun 16, 2022

    @cmb69
    Member

    Thanks for reporting!

    We're still on 5.40. We should definitely update "master" (which will become PHP-8.2 in some weeks) to 5.42; I'm not quite sure about 5.41PHP-8.1; maybe just patching our 5.40 would make more sense.

  2. added this to the PHP 8.2 milestone on Jun 19, 2022
  3. adoy commented on Jun 22, 2022

    @adoy
    Member

    @weltling You were the last one to update libmagic if i'm not wrong. Do you think it would be possible to update to 5.42 in master ? I would love to help but not sure what's the process to update this lib.

  4. weltling commented on Sep 10, 2022

    @weltling
    Contributor

    @kojot1234 could you share a suitable file to test this please?

    @adoy @cmb69 probably too late for 8.2, but I'll plan to spend time porting the latest libmagic in the coming months. Once ported to main one can see if a backport to 8.2 is acceptable. Small data backports are always possible, anyway, as in most case it's about the magic itself, not about the lib code. Upgrading the lib is not trivial, that's why there's no standard procedure for that.

    Thanks

  5. kojot1234 commented on Sep 15, 2022

    @kojot1234
    Author

    Thank you, I'm not able to attach woff in github, you can grab any of the files from this link: https://filesamples.com/formats/woff

  6. added a commit that references this issue on Sep 18, 2022
    34fa65a
  7. 7 remaining items

  8. added a commit that references this issue on Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions