Flesh out MIME type utilities in RBTools.

Review Request #13567 — Created Feb. 21, 2024 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

RBTools had some MIME type stuff already to deal with the content types
for the API, living in rbtools.api.utils. This change takes the
generic parts of that and moves them into a new module,
rbtools.utils.mimetypes. This also adds two new methods inspired by
similar code in Review Board for guessing the MIME type of a file and
for checking to see if a MIME type matches a given accept-type pattern.

I would like to replace the file-based MIME type detection with
Google's newly open sourced magika project. At the moment, magika does
not support Python 3.12, so we have to go with this as-is.

Testing Done:
- Ran unit tests.
- Used the MIME type parsing, guessing, and matching in other changes.


 

Commits

Files

    Loading...