From 14602be0ca1073c7a062cdf9e59010bc5111b0b3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 3 Jul 2020 10:40:23 +1000 Subject: [PATCH] port previous css workaround to flask --- qt/aqt/mediasrv.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index 51356106a..430deb90d 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -138,7 +138,13 @@ def allroutes(pathin): response.headers["Content-Type"] = "application/binary" return response - return flask.send_file(fullpath, conditional=True) + if fullpath.endswith(".css"): + # some users may have invalid mime type in the Windows registry + mimetype = "text/css" + else: + # autodetect + mimetype = None + return flask.send_file(fullpath, mimetype=mimetype, conditional=True) except Exception as error: if devMode: