Skip to content

Commit

Permalink
Don't url escape filenames on download
Browse files Browse the repository at this point in the history
  • Loading branch information
gnestor committed Aug 15, 2017
1 parent f8d4d6a commit 64ed6e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion notebook/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion notebook/files/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
4 changes: 2 additions & 2 deletions notebook/nbconvert/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 64ed6e4

Please sign in to comment.