ahupp / python-magic

A python wrapper for libmagic
Other
2.6k stars 280 forks source link

Difference in detected mime-type between libmagic 5.38 and 5.40 #246

Closed shuttlesworthNEO closed 3 years ago

shuttlesworthNEO commented 3 years ago

While running some tests I encountered a discrepancy between the expected mime type. Using libmagic 5.40 the mime type detected is application/octet-stream whereas with libmagic 5.38 the detected mime type is text/plain

Here's a sample snippet to reproduce the issue

import io, magic
buff = io.BytesIO()
buff.write(b'000000000000000000000')
buff.seek(0)
magic.from_buffer(buff.read(), mime=True)
ahupp commented 3 years ago

python-magic is a wrapper around the underlying libmagic implementation. libmagic often changes detection rules to fix bugs etc.

If you believe this is a bug, you can report it here: https://bugs.astron.com/my_view_page.php

shuttlesworthNEO commented 3 years ago

Thank you for pointing out @ahupp! Looks similar to https://bugs.astron.com/view.php?id=180#c3602