|
a/webui.py |
|
b/webui.py |
|
... |
|
... |
335 |
if (not doc.ipath) and "filename" in doc.keys():
|
335 |
if (not doc.ipath) and "filename" in doc.keys():
|
336 |
filename = doc.filename
|
336 |
filename = doc.filename
|
337 |
else:
|
337 |
else:
|
338 |
filename = os.path.basename(path)
|
338 |
filename = os.path.basename(path)
|
339 |
bottle.response.headers['Content-Disposition'] = \
|
339 |
bottle.response.headers['Content-Disposition'] = \
|
340 |
'attachment; filename="%s"' % filename.encode('utf-8')
|
340 |
'attachment; filename="%s"' % filename
|
341 |
path = path.encode('utf-8')
|
|
|
342 |
bottle.response.headers['Content-Length'] = os.stat(path).st_size
|
341 |
bottle.response.headers['Content-Length'] = os.stat(path).st_size
|
343 |
f = open(path, 'r')
|
342 |
f = open(path, 'rb')
|
344 |
if pathismine:
|
343 |
if pathismine:
|
345 |
os.unlink(path)
|
344 |
os.unlink(path)
|
346 |
return f
|
345 |
return f
|
347 |
#}}}
|
346 |
#}}}
|
348 |
#{{{ json
|
347 |
#{{{ json
|