1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00

Fix mimetype for javascript, #1559

This commit is contained in:
ziajka 2019-03-22 08:35:27 +01:00
parent cbb6eccad8
commit 3f4bdfef11
2 changed files with 8 additions and 1 deletions

View File

@ -92,7 +92,13 @@ class IndexHandler:
if static is None or not os.path.exists(static):
static = get_resource(os.path.join('static', 'web-ui', 'index.html'))
await response.stream_file(static)
# guesstype prefers to have text/html type than application/javascript
# which results with warnings in Firefox 66 on Windows
# Ref. gns3-server#1559
_, ext = os.path.splitext(static)
mimetype = ext == '.js' and 'application/javascript' or None
await response.stream_file(static, status=200, set_content_type=mimetype)
@Route.get(
r"/v1/version",

View File

@ -118,6 +118,7 @@ class Response(aiohttp.web.Response):
"""
Stream a file as a response
"""
encoding = None
if not os.path.exists(path):
raise aiohttp.web.HTTPNotFound()