Closed tgalante-wavefin closed 2 years ago
This is a behavior of the underlying libmagic library, and tbh I'm not really sure why it happens.
Can you share the BMP file?
Sure, it's here.
Looks like it works if you read the whole file:
>>> b = open("/home/adam/home/Downloads/test.bmp", "rb").read()
>>> magic.from_buffer(b, mime=True)
'image/bmp'
I'm not sure why libmagic requires that.
Interesting, I wonder why the implementation changed. Regardless, thanks for looking into it!
I have a bit of a strange issue, which I can only guess is because of a
libmagic
update (recently updated our base image), but perhaps you can shed some light on this. Trying to check mime types to ensure an image file is supported, but one of our tests are failing on a specific BMP image (other images seem to be fine).from_file
seems to work as expected, butfrom_buffer
does not.Any idea as to why this might be happening?