Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FilesHandler not meet RFC 6713 #6287

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
Fix FilesHandler not meet RFC 6713
jizhongsheng committed Feb 18, 2022

Unverified

This user has not yet uploaded their public signing key.
commit ce9ad0d7ceef8117af6450f7f56142476ea3f2a5
7 changes: 6 additions & 1 deletion notebook/files/handlers.py
Original file line number Diff line number Diff line change
@@ -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: