From 972c9da12e1e44fc2d80b2a90fa354f758e71da5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 28 Dec 2021 13:50:11 +1000 Subject: [PATCH] don't cache js files https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/101 --- qt/aqt/mediasrv.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index d6c0d4516..57271e163 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -173,8 +173,12 @@ def _handle_local_file_request(request: LocalFileRequest) -> Response: mimetype = _mime_for_path(fullpath) if os.path.exists(fullpath): if fullpath.endswith(".css"): - # make changes to css files immediately reflected in the webview + # caching css files prevents flicker in the webview, but we want + # a short cache max_age = 10 + elif fullpath.endswith(".js"): + # don't cache js files + max_age = 0 else: max_age = 60 * 60 return flask.send_file(