This commit is contained in:
lelo 2025-05-30 09:47:06 +00:00
parent 191b54f113
commit 17c8a41229

8
app.py
View File

@ -466,7 +466,7 @@ def serve_file(subpath):
filesize = os.path.getsize(file_path)
# 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)
# Single send_file call with proper attachment handling
@ -474,10 +474,10 @@ def serve_file(subpath):
file_path,
mimetype=mime,
conditional=True,
as_attachment=ask_download,
download_name=filename if ask_download else None
as_attachment=as_attachment ,
download_name=filename if as_attachment else None
)
if not ask_download:
if not as_attachment :
response.headers['Content-Disposition'] = 'inline'
response.headers['Cache-Control'] = 'public, max-age=86400'