cleanup
This commit is contained in:
parent
191b54f113
commit
17c8a41229
8
app.py
8
app.py
@ -466,7 +466,7 @@ def serve_file(subpath):
|
|||||||
filesize = os.path.getsize(file_path)
|
filesize = os.path.getsize(file_path)
|
||||||
|
|
||||||
# Figure out download flag and filename
|
# Figure out download flag and filename
|
||||||
ask_download = request.args.get('download') == 'true'
|
as_attachment = request.args.get('download') == 'true'
|
||||||
filename = os.path.basename(full_path)
|
filename = os.path.basename(full_path)
|
||||||
|
|
||||||
# Single send_file call with proper attachment handling
|
# Single send_file call with proper attachment handling
|
||||||
@ -474,10 +474,10 @@ def serve_file(subpath):
|
|||||||
file_path,
|
file_path,
|
||||||
mimetype=mime,
|
mimetype=mime,
|
||||||
conditional=True,
|
conditional=True,
|
||||||
as_attachment=ask_download,
|
as_attachment=as_attachment ,
|
||||||
download_name=filename if ask_download else None
|
download_name=filename if as_attachment else None
|
||||||
)
|
)
|
||||||
if not ask_download:
|
if not as_attachment :
|
||||||
response.headers['Content-Disposition'] = 'inline'
|
response.headers['Content-Disposition'] = 'inline'
|
||||||
response.headers['Cache-Control'] = 'public, max-age=86400'
|
response.headers['Cache-Control'] = 'public, max-age=86400'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user