Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1d2c19b

Browse files
committed
Fix for css bad Content-Type
1 parent 96f6900 commit 1d2c19b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎server.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ def text_file_response(filename):
159159
'Content-Disposition': 'inline'
160160
})
161161

162+
def css_file_response(filename):
163+
with open(filename) as f:
164+
return web.Response(body=f.read().encode(), headers={
165+
'Content-Type': 'text/css',
166+
'Content-Disposition': 'inline'
167+
})
162168

163169
def html_response(filename):
164170
with open(filename) as f:
@@ -226,6 +232,8 @@ async def handle(request):
226232
if not filetype:
227233
filetype = filetype_fallback(filename)
228234
if 'text' in filetype:
235+
if filename.endswith('.css'):
236+
return css_file_response(filename)
229237
return text_file_response(filename)
230238
else:
231239
return await binary_file_response(filename, filetype, request)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /