|
a/webui.py |
|
b/webui.py |
|
... |
|
... |
314 |
|
314 |
|
315 |
xt = rclextract.Extractor(doc)
|
315 |
xt = rclextract.Extractor(doc)
|
316 |
path = xt.idoctofile(doc.ipath, doc.mimetype)
|
316 |
path = xt.idoctofile(doc.ipath, doc.mimetype)
|
317 |
pathismine = True
|
317 |
pathismine = True
|
318 |
|
318 |
|
|
|
319 |
if (not doc.ipath) and "filename" in doc.keys():
|
|
|
320 |
filename = doc.filename
|
|
|
321 |
else:
|
|
|
322 |
filename = os.path.basename(path)
|
319 |
bottle.response.headers['Content-Disposition'] = \
|
323 |
bottle.response.headers['Content-Disposition'] = \
|
320 |
'attachment; filename="%s"' % os.path.basename(path).encode('utf-8')
|
324 |
'attachment; filename="%s"' % filename.encode('utf-8')
|
321 |
path = path.encode('utf-8')
|
325 |
path = path.encode('utf-8')
|
322 |
bottle.response.headers['Content-Length'] = os.stat(path).st_size
|
326 |
bottle.response.headers['Content-Length'] = os.stat(path).st_size
|
323 |
f = open(path, 'r')
|
327 |
f = open(path, 'r')
|
324 |
if pathismine:
|
328 |
if pathismine:
|
325 |
os.unlink(path)
|
329 |
os.unlink(path)
|