Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lookupMimeType(path, headerBytes) returning TRUE on passing incorrect headerBytes as well #430

Open
rastogitech opened this issue Jun 1, 2024 · 0 comments

Comments

@rastogitech
Copy link

rastogitech commented Jun 1, 2024

Action:

  • For a particular file, verify whether the MIME type coming from its extension name and header bytes are both same.
  • Task performed: lookupMimeType('file.jpeg', headerBytes: [0x89])

Expected behaviour:
FALSE

Actual result:
TRUE

Description:

  • As per the magic_number.dart, the magic bytes of JPEG file is [0xFF, 0xD8].
  • So, calling lookupMimeType('file.jpeg', headerBytes: [0x89]) should have returned FALSE, instead of TRUE.
  • I'm passing header bytes explicitly, so the match must fail if the header bytes don't match with the magic bytes.
@rastogitech rastogitech changed the title lookupMimeType() with magic bytes (file signature) is buggy lookupMimeType() with magic bytes/file signature is buggy Jun 1, 2024
@rastogitech rastogitech changed the title lookupMimeType() with magic bytes/file signature is buggy lookupMimeType(path, headerBytes) returning TRUE on passing incorrect headerBytes as well Jun 1, 2024
@mosuem mosuem transferred this issue from dart-archive/mime Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants