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

chose appropriate file name extension for downloading a subdocument

parent c11608b6
......@@ -294,16 +294,17 @@ def edit(resnum):
doc = rclq.fetchone()
bottle.response.content_type = doc.mimetype
bottle.response.headers['Content-Disposition'] = \
'attachment; filename=%s' % doc.filename
# If ipath is null, we can just return the file
pathismine = False
if doc.ipath == '':
# If ipath is null, we can just return the file
path = doc.url.replace('file://','')
# Else this is a subdocument, extract to temporary file
xt = rclextract.Extractor(doc)
path = xt.idoctofile(doc.ipath, doc.mimetype)
pathismine = True
bottle.response.headers['Content-Disposition'] = \
'attachment; filename=%s' % os.path.basename(path)
print >> sys.stderr, "Sending %s with mimetype %s" % (path, doc.mimetype)
f = open(path, 'r')
if pathismine:
Supports Markdown
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