Add utf-8 charset header to more types

This commit is contained in:
shortcutme 2019-10-28 16:43:19 +01:00
parent 24ba2a150b
commit cb4a4bd707
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -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-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Cookie, Range"
headers["Access-Control-Allow-Credentials"] = "true" headers["Access-Control-Allow-Credentials"] = "true"
if content_type == "text/html": if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"):
content_type = "text/html; charset=utf-8" content_type += "; charset=utf-8"
if content_type == "text/plain":
content_type = "text/plain; charset=utf-8"
# Download instead of display file types that can be dangerous # Download instead of display file types that can be dangerous
if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type): if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type):