@@ -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