From cb4a4bd7076fbfe760bc88c46d90157c1a19cebf Mon Sep 17 00:00:00 2001 From: shortcutme Date: Mon, 28 Oct 2019 16:43:19 +0100 Subject: [PATCH] Add utf-8 charset header to more types --- src/Ui/UiRequest.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Ui/UiRequest.py b/src/Ui/UiRequest.py index 4c4281c3..41f7b185 100644 --- a/src/Ui/UiRequest.py +++ b/src/Ui/UiRequest.py @@ -292,10 +292,8 @@ class UiRequest(object): headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Cookie, Range" headers["Access-Control-Allow-Credentials"] = "true" - if content_type == "text/html": - content_type = "text/html; charset=utf-8" - if content_type == "text/plain": - content_type = "text/plain; charset=utf-8" + if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"): + content_type += "; charset=utf-8" # Download instead of display file types that can be dangerous if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type):