Commit 6c0666e9 authored by Martin Urban's avatar Martin Urban
Browse files

File: Allow download for all files, fix download bug for mimetype None, fix #1842

parent 75a86a89
......@@ -25,7 +25,8 @@ class FSController(AbstractController):
download = True
wid = cherrypy.request.private_params.get('_workspaceId', None)
data, contenttype, _ = self.handleDownload(path, wid)
cherrypy.response.headers['Content-Type'] = contenttype
if contenttype != None:
cherrypy.response.headers['Content-Type'] = contenttype
if download: # or not isbrowserfile:
disposition = 'attachment; filename=%s' % path.split('/')[-1]
cherrypy.response.headers['Content-Disposition'] = disposition
......@@ -36,11 +37,11 @@ class FSController(AbstractController):
# get the content type depending on the file extension
ext = path.split('.')[-1]
mimetype = fs.get_mime_type(path)
if mimetype is None:
raise Exception('The file extension \'%s\ is not supported by this server' % ext)
# if mimetype is None:
# raise Exception('The file extension \'%s\ is not supported by this server' % ext)
if not fs.exists(path, 'f'):
raise Exception('The file \'%s\' does not exist' % path)
raise MessageException('The file \'%s\' does not exist' % path)
# Set the Last-Modified response header, so that
# modified-since validation code can work.
......
......@@ -71,7 +71,12 @@ var FileBaseActions = Class.extend({
function(result) {
if (result === true) {
self._openWithCodeEditor(path);
}
} else self.FileBase.instance.confirm("Do you want to download \"" + name + " (" +
size + ")\"?", function(res2) {
if(res2 === true) {
self.download();
}
});
});
}
// })
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment