python-magic icon indicating copy to clipboard operation
python-magic copied to clipboard

application/octet-stream with text files on windows

Open prchristie opened this issue 2 years ago • 1 comments

On Windows 10 a plain text buffer is classified as application/octet-stream which is indicative of a binary file (I think). Ubuntu Linux is correctly identifying as "text/plain".

Python3.9, python-magic-bin as the driver for magiclib

How to reproduce

content = "Bunch of fake content" * 8192

magic = Magic(mime=True)
mimetype = magic.from_buffer(content[0:8192]) # Index to replicate my environment

prchristie avatar Jul 07 '22 06:07 prchristie

I have the exact same issue. With Ubuntu it gives me the correct file type, Windows its always application/octet-stream.

zwnk avatar Apr 19 '23 20:04 zwnk