`from_buffer()` issue with file-5.47
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 304
- PR merge metrics
- No merged PRs in 30d
Description
Using archlinux, with python-magic 0.4.27, there seems to be an issue with file-5.47-1 and python-magic when using from_buffer
In [1]: import magic
In [2]: magic.from_file("sample.mp4", mime=True)
Out[2]: 'video/mp4'
In [3]: magic.from_buffer(open("sample.mp4", "rb").read(2048), mime=True)
Out[3]: 'application/octet-stream'
In [4]: magic.from_file("sample.webm", mime=True)
Out[4]: 'video/webm'
In [5]: magic.from_buffer(open("sample.webm", "rb").read(2048), mime=True)
Out[5]: 'application/octet-stream'
after downgrading to file-5.46-5 everything works
In [1]: import magic
In [2]: magic.from_file("sample.mp4", mime=True)
Out[2]: 'video/mp4'
In [3]: magic.from_buffer(open("sample.mp4", "rb").read(2048), mime=True)
Out[3]: 'video/mp4'
In [4]: magic.from_file("sample.webm", mime=True)
Out[4]: 'video/webm'
In [5]: magic.from_buffer(open("sample.webm", "rb").read(2048), mime=True)
Out[5]: 'video/webm'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the from_buffer and from_file examples on Arch Linux with python-magic 0.4.27 and file-5.47, then compare with file-5.46-5. Inspect the from_buffer path and its interaction with libmagic. Done means video/mp4 and video/webm are returned for the buffer calls under file-5.47.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100