Skip to content

Commit ce9ad0d

Browse files
author
jizhongsheng
committed
Fix FilesHandler not meet RFC 6713
1 parent 2662634 commit ce9ad0d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

notebook/files/handlers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ def get(self, path, include_body=True):
5959
if name.lower().endswith('.ipynb'):
6060
self.set_header('Content-Type', 'application/x-ipynb+json')
6161
else:
62-
cur_mime = mimetypes.guess_type(name)[0]
62+
cur_mime, encoding = mimetypes.guess_type(name)
6363
if cur_mime == 'text/plain':
6464
self.set_header('Content-Type', 'text/plain; charset=UTF-8')
65+
# RFC 6713
66+
if encoding == 'gzip':
67+
self.set_header('Content-Type', 'application/gzip')
68+
elif encoding is not None:
69+
self.set_header('Content-Type', 'application/octet-stream')
6570
elif cur_mime is not None:
6671
self.set_header('Content-Type', cur_mime)
6772
else:

0 commit comments

Comments
 (0)