Add support for puremagic for guess_mimetype

Review Request #14091 — Created Aug. 8, 2024 and updated

Information

RBTools
release-5.x

Reviewers

If a system has no "file" binary it is sometimes
easier and faster to install "puremagic" from pypi.
So let's try puremagic if we cannot find "file".

Removed "file" binary from system and saw that "rbt post" won't upload
images like png/jpg because guess_mimetype cannot detect it.
Installed puremagic from pypi and saw that images can be uploaded again.

Summary ID
Add support for puremagic for guess_mimetype
If a system has no "file" binary it is sometimes easier and faster to install "puremagic" from pypi. So let's try puremagic if we cannot find "file".
85d9c478093030340c85c31da63d3c64833fa3e8
Description From Last Updated

This is a neat module. I like the idea. I think David was looking into some other tool that could …

chipx86chipx86
chipx86
  1. 
      
  2. Show all issues

    This is a neat module. I like the idea. I think David was looking into some other tool that could also be used for file type matching as well.

    I think we should probably explicitly add puremagic as a dependency so it's guaranteed to be available if file can't be used.

    1. Ok, but sometimes it is a little annoying for package maintainers to add python dependencies. But I looked into Arch- and AlpineLinux and I can add it to the package.

    2. It's a difficult balance for sure, particularly for RBTools. We have to make dependency changes from time to time, and have a couple more that will be coming for the next major version of RBTools. I think this one may be worth making mandatory, but I'd love David's thoughts on this one.

  3. 
      
misery
Review request changed
Commits:
Summary ID
Add support for puremagic for guess_mimetype
If a system has no "file" binary it is sometimes easier and faster to install "puremagic" from pypi. So let's try puremagic if we cannot find "file".
e2c76f9d97ed3dae6ed0483ddbd957340ce01070
Add support for puremagic for guess_mimetype
If a system has no "file" binary it is sometimes easier and faster to install "puremagic" from pypi. So let's try puremagic if we cannot find "file".
85d9c478093030340c85c31da63d3c64833fa3e8

Checks run (2 succeeded)

flake8 passed.
JSHint passed.