Commit 6e896daf authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Download: try to restore the original file name when it makes sense

parent d715d3e2
......@@ -316,8 +316,12 @@ def edit(resnum):
path = xt.idoctofile(doc.ipath, doc.mimetype)
pathismine = True
if (not doc.ipath) and "filename" in doc.keys():
filename = doc.filename
filename = os.path.basename(path)
bottle.response.headers['Content-Disposition'] = \
'attachment; filename="%s"' % os.path.basename(path).encode('utf-8')
'attachment; filename="%s"' % filename.encode('utf-8')
path = path.encode('utf-8')
bottle.response.headers['Content-Length'] = os.stat(path).st_size
f = open(path, 'r')
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