Closed livid closed 2 years ago
But libmagic cannot:
This line is logged by us, first i try to get mime by using magic, if magic can't get it or result is not in our supported-mime list(means we can't handle this kind of mime), i'll log this.
Actually, in the above case, application/octet-stream
is result that mgaic get, magic
guess mime type by the first few bytes of byte stream, same as PIL, but the types supported by PIL are limited, if PIL can recognize, magic
should be able too.
It's a little strange. magic didn't get the correct mime from bytes content, i'll test and find out.
I test it by curl with cap.avif
in repo, seesm normal.
I guess you are testing on macOS.
Can you try Ubuntu or Debian?
CI is now failing for the same reason:
Sure, let me create on first😂
Seems magic
not support avif now, but pillow-avif-plugin
allows PIL to handle avif.
If magic gets the valid mime then use it, otherwise try to get mime by using PIL, how about that?
Maybe there is a component in my macOS that supports magic to handle avif.🤔
It seems Magic on macOS can recognize it. But the production server is running Debian with Docker.
Yes, we need to turn these tests green. Thanks!
With the current implementation, to recognize an image, it needs to be both recognized by libmagic and Pillow. And that caused test for AVIF to fail. Because while Pillow.Image can recognize it:
But libmagic cannot:
If Pillow.Image can return a meaningful result, libmagic should not block the process.