Merge pull request #8005 from minrk/files-as-file

Get /files/ unmodified from contents
This commit is contained in:
Thomas Kluyver 2015-03-13 12:35:15 -07:00
commit cf6925ce7a

View File

@ -28,12 +28,13 @@ class FilesHandler(IPythonHandler):
else: else:
name = path name = path
model = cm.get(path) model = cm.get(path, type='file')
if self.get_argument("download", False): if self.get_argument("download", False):
self.set_header('Content-Disposition','attachment; filename="%s"' % name) self.set_header('Content-Disposition','attachment; filename="%s"' % name)
if model['type'] == 'notebook': # get mimetype from filename
if name.endswith('.ipynb'):
self.set_header('Content-Type', 'application/json') self.set_header('Content-Type', 'application/json')
else: else:
cur_mime = mimetypes.guess_type(name)[0] cur_mime = mimetypes.guess_type(name)[0]