From 64ed6e439c22bac479f82fce5f8206c8f96a8299 Mon Sep 17 00:00:00 2001 From: Grant Nestor Date: Mon, 14 Aug 2017 23:04:25 -0700 Subject: [PATCH] Don't url escape filenames on download --- notebook/base/handlers.py | 2 +- notebook/files/handlers.py | 2 +- notebook/nbconvert/handlers.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py index 76651e9e0d..4a88744ffd 100755 --- a/notebook/base/handlers.py +++ b/notebook/base/handlers.py @@ -478,7 +478,7 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler): def get(self, path): if os.path.splitext(path)[1] == '.ipynb' or self.get_argument("download", False): name = path.rsplit('/', 1)[-1] - self.set_header('Content-Disposition','attachment; filename="%s"' % escape.url_escape(name)) + self.set_header('Content-Disposition','attachment; filename="%s"' % name) return web.StaticFileHandler.get(self, path) diff --git a/notebook/files/handlers.py b/notebook/files/handlers.py index 4eaeb03955..193eaa8604 100644 --- a/notebook/files/handlers.py +++ b/notebook/files/handlers.py @@ -46,7 +46,7 @@ def get(self, path, include_body=True): model = cm.get(path, type='file', content=include_body) if self.get_argument("download", False): - self.set_header('Content-Disposition','attachment; filename="%s"' % escape.url_escape(name)) + self.set_header('Content-Disposition','attachment; filename="%s"' % name) # get mimetype from filename if name.endswith('.ipynb'): diff --git a/notebook/nbconvert/handlers.py b/notebook/nbconvert/handlers.py index 648c9827f8..c7da994d13 100644 --- a/notebook/nbconvert/handlers.py +++ b/notebook/nbconvert/handlers.py @@ -39,7 +39,7 @@ def respond_zip(handler, name, output, resources): # Headers zip_filename = os.path.splitext(name)[0] + '.zip' handler.set_header('Content-Disposition', - 'attachment; filename="%s"' % escape.url_escape(zip_filename)) + 'attachment; filename="%s"' % zip_filename) handler.set_header('Content-Type', 'application/zip') # Prepare the zip file @@ -115,7 +115,7 @@ def get(self, format, path): if self.get_argument('download', 'false').lower() == 'true': filename = os.path.splitext(name)[0] + resources['output_extension'] self.set_header('Content-Disposition', - 'attachment; filename="%s"' % escape.url_escape(filename)) + 'attachment; filename="%s"' % filename) # MIME type if exporter.output_mimetype: