Flesh out MIME type utilities in RBTools.
Review Request #13567 — Created Feb. 21, 2024 and submitted
RBTools had some MIME type stuff already to deal with the content types
for the API, living inrbtools.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 sourcedmagikaproject. 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.
| Summary | ID |
|---|---|
| 22ebafd11551a8f7f8b23647c4fe5b598e869839 |
| Description | From | Last Updated |
|---|---|---|
|
Should these go at the top of the file in a block after the imports? |
|