Compare commits

..

No commits in common. "b35e4030ace54edd81a555f910163cda983efb9c" and "191b54f113f8884ac40281ddc7e3545b436e54a7" have entirely different histories.

22
app.py
View File

@ -466,30 +466,18 @@ def serve_file(subpath):
filesize = os.path.getsize(file_path)
# Figure out download flag and filename
as_attachment = request.args.get('download') == 'true'
ask_download = request.args.get('download') == 'true'
filename = os.path.basename(full_path)
if as_attachment:
download_name = filename
mimetype = 'application/octet-stream'
else:
download_name = None
mimetype = mime
# Single send_file call with proper attachment handling
response = send_file(
file_path,
mimetype=mimetype,
mimetype=mime,
conditional=True,
as_attachment=as_attachment ,
download_name=download_name
as_attachment=ask_download,
download_name=filename if ask_download else None
)
if as_attachment:
response.headers['X-Content-Type-Options'] = 'nosniff'
if not as_attachment :
if not ask_download:
response.headers['Content-Disposition'] = 'inline'
response.headers['Cache-Control'] = 'public, max-age=86400'