Skip to content

Commit 7bf7900

Browse files
authored
Merge pull request #2453 from krzotr/patch-7
Fixed `Cache-Control` for .js and .css files - 10 minutes cache
2 parents f46b945 + 5baacf9 commit 7bf7900

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Ui/UiRequest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ def sendHeader(self, status=200, content_type="text/html", noscript=False, allow
299299
headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept, Cookie, Range"
300300
headers["Access-Control-Allow-Credentials"] = "true"
301301

302-
if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"):
303-
content_type += "; charset=utf-8"
304-
305302
# Download instead of display file types that can be dangerous
306303
if re.findall("/svg|/xml|/x-shockwave-flash|/pdf", content_type):
307304
headers["Content-Disposition"] = "attachment"
@@ -312,6 +309,9 @@ def sendHeader(self, status=200, content_type="text/html", noscript=False, allow
312309
content_type in ("application/javascript", "text/css")
313310
)
314311

312+
if content_type in ("text/plain", "text/html", "text/css", "application/javascript", "application/json", "application/manifest+json"):
313+
content_type += "; charset=utf-8"
314+
315315
if status in (200, 206) and cacheable_type: # Cache Css, Js, Image files for 10min
316316
headers["Cache-Control"] = "public, max-age=600" # Cache 10 min
317317
else:

0 commit comments

Comments
 (0)