-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tauon blindly trusts file extension, causing files to be read wrong #1362
Comments
as my PR isn't getting merged, you can also try https://pypi.org/project/puremagic |
another reliable option is import subprocess, json
def get_metadata(path_in: str):
args = [
"ffprobe",
"-loglevel",
"error",
"-print_format",
"json",
"-show_format",
"-show_streams",
path_in,
]
output = subprocess.check_output(args, text=True)
return json.loads(output) easy to install, or embed as hardened binary in the wheel using for instance https://github.com/wader/static-ffmpeg |
I don't want a hard dependency on FFMPEG, also Tauon is intended to be easy to build from source so we should avoid depending on binarys. |
Building aside, the binary is not a good idea since it'd be exec'd for each file on import/rescan, but it's good to know it's an option. We're probably best off figuring out how to use puremagic/python-magic, but the PR'd python-magic somehow broke Windows msys2 Python slash pyinstaller, so I'll have to take a look at that later... |
That sounds interesting 🤔 how do you deduce that relation? my PR adds wheels, which install exclusively into the |
You can check pyinstaller/pyinstaller#8883 (comment) out, but I really haven't put time into it other than figuring out If you really want to investigate, you can fork this branch and uncomment the import line in t_main.py, CI will try to build it and fail/freeze. |
to this comment, fwiw, my PR is testing the windows wheel on the windows runner after building the wheel in an isolated docker container: https://github.com/ahupp/python-magic/blob/65fb61c9c9aa6348bb95d1dd71b685720c2a8a23/.github/workflows/wheels.yml#L99-L100 can you run that test command in your env after a force reinstall? # comma separated list of URLs for --find-links
export PIP_FIND_LINKS=https://github.com/ddelange/python-magic/releases/expanded_assets/0.4.28.post8
pip install --force-reinstall python-magic |
I think there is an interest in keeping the dependency graph under control. And this is something that can be done in-house. |
sure, here my interest is to figure out whether my python-magic PR needs fixing 😅 most likely puremagic is sufficient for your use case 👍 |
We should use whatever equivalent of
file
Python has to detect file mimetype instead.EDIT: python-magic + python-magic-bin on Windows, only python-magic once ahupp/python-magic#294 is settled and a release is made.
Probably throw a warning in the log to alert user that their file has a broken extension too.
TODO: Should follow up on pyinstaller/pyinstaller#8883 (comment)
The text was updated successfully, but these errors were encountered: