From ec53ba602d715cdc8badd00c525e8d163ac45bfc Mon Sep 17 00:00:00 2001 From: m9810223 Date: Mon, 6 Nov 2023 23:54:06 +0800 Subject: [PATCH] feat: update overriding mimetype (Python 3.12) hide error message: `Invalid mimetype set for '.js', overriding` - `mimetype` sometimes broken on windows: - use `text/javascript`: ```console $ fava bcs/main.bc -p 5001 Invalid mimetype set for '.js', overriding # <- ! Starting Fava on http://127.0.0.1:5001 ``` --- src/fava/application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fava/application.py b/src/fava/application.py index d36788625..9c617e106 100644 --- a/src/fava/application.py +++ b/src/fava/application.py @@ -93,11 +93,11 @@ ] -if mimetypes.types_map.get(".js") != "application/javascript": +if not mimetypes.types_map.get(".js", "").endswith("/javascript"): # This is sometimes broken on windows, see # https://github.com/beancount/fava/issues/1446 logging.error("Invalid mimetype set for '.js', overriding") - mimetypes.add_type("application/javascript", ".js") + mimetypes.add_type("text/javascript", ".js") def _ledger_slugs_dict(ledgers: Iterable[FavaLedger]) -> dict[str, FavaLedger]: