diff --git a/notebook/files/handlers.py b/notebook/files/handlers.py index b412cd84e5..dd28757686 100644 --- a/notebook/files/handlers.py +++ b/notebook/files/handlers.py @@ -59,9 +59,14 @@ def get(self, path, include_body=True): if name.lower().endswith('.ipynb'): self.set_header('Content-Type', 'application/x-ipynb+json') else: - cur_mime = mimetypes.guess_type(name)[0] + cur_mime, encoding = mimetypes.guess_type(name) if cur_mime == 'text/plain': self.set_header('Content-Type', 'text/plain; charset=UTF-8') + # RFC 6713 + if encoding == 'gzip': + self.set_header('Content-Type', 'application/gzip') + elif encoding is not None: + self.set_header('Content-Type', 'application/octet-stream') elif cur_mime is not None: self.set_header('Content-Type', cur_mime) else: