dart-lang / tools

This repository is home to tooling related Dart packages.
BSD 3-Clause "New" or "Revised" License
28 stars 20 forks source link

Incorrect mime providing headerBytes #414

Open phath9 opened 2 years ago

phath9 commented 2 years ago

Steps to reproduce:

  1. Get a sample PNG file: https://upload.wikimedia.org/wikipedia/sco/a/aa/Bart_Simpson_200px.png
  2. Use lookupMimeType method: lookupMimeType('Bart_Simpson_200px.png', headerBytes: [0xFF, 0xD8]);
  3. It returns image/jpeg when expected result should be image/png
mx1up commented 1 year ago

if you want to pass header bytes, they should be coming from the file itself. in your sample code, you passed hard coded header bytes which would be matching a jpeg, so it's logical it returns image/jpeg