From 19c6cbb618fe4d0cd8f830772640b60b423377a5 Mon Sep 17 00:00:00 2001 From: Ciaran Langton Date: Sun, 10 Mar 2019 21:51:29 +0000 Subject: [PATCH 1/2] Fix incorrect MIME type for JavaScript --- notebook/notebookapp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index bbbe90c313..842428c4e7 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1619,10 +1619,12 @@ def init_server_extensions(self): def init_mime_overrides(self): # On some Windows machines, an application has registered an incorrect - # mimetype for CSS in the registry. Tornado uses this when serving - # .css files, causing browsers to reject the stylesheet. We know the - # mimetype always needs to be text/css, so we override it here. + # mimetype for CSS and JavaScript in the registry. + # Tornado uses this when serving .css files, causing browsers to reject the stylesheet. + # We know the mimetype always needs to be text/css for css + # and application/javascript for JS, so we override it here. mimetypes.add_type('text/css', '.css') + mimetypes.add_type('application/javascript', '.js') def shutdown_no_activity(self): From d8730ced00132b1cdd4434f5e642a91acba6372a Mon Sep 17 00:00:00 2001 From: Ciaran Langton Date: Sun, 10 Mar 2019 22:13:22 +0000 Subject: [PATCH 2/2] Fix comment --- notebook/notebookapp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 842428c4e7..6607dc1a33 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1620,8 +1620,8 @@ def init_server_extensions(self): def init_mime_overrides(self): # On some Windows machines, an application has registered an incorrect # mimetype for CSS and JavaScript in the registry. - # Tornado uses this when serving .css files, causing browsers to reject the stylesheet. - # We know the mimetype always needs to be text/css for css + # Tornado uses this when serving .css and .js files, causing browsers to + # reject these files. We know the mimetype always needs to be text/css for css # and application/javascript for JS, so we override it here. mimetypes.add_type('text/css', '.css') mimetypes.add_type('application/javascript', '.js')