Skip to content

Commit

Permalink
feat: update overriding mimetype
Browse files Browse the repository at this point in the history
(Python 3.12) hide error message: `Invalid mimetype set for '.js', overriding`
- `mimetype` sometimes broken on windows: <#1446>
- use `text/javascript`: <python/cpython#97646>
```console
$ fava bcs/main.bc -p 5001
Invalid mimetype set for '.js', overriding  # <- !
Starting Fava on http://127.0.0.1:5001
```
  • Loading branch information
m9810223 authored and yagebu committed Nov 11, 2023
1 parent e23773e commit ec53ba6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fava/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit ec53ba6

Please sign in to comment.