fix: PDFs im Preview-iframe statt neuem Tab
Download-Endpoint unterstuetzt jetzt ?inline=1, wodurch Content-Disposition auf inline statt attachment gesetzt wird. PDF- und Bild-Preview nutzen diesen Parameter, damit der Browser das PDF im Preview-Iframe rendert statt einen Download auszuloesen. Normale Download-Buttons bleiben unveraendert. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -283,8 +283,11 @@ def download_file(file_id):
|
||||
if not filepath.exists():
|
||||
return jsonify({'error': 'Datei auf Datentraeger nicht gefunden'}), 404
|
||||
|
||||
return send_file(str(filepath), mimetype=f.mime_type, as_attachment=True,
|
||||
download_name=f.name)
|
||||
# inline=1 renders the file in-browser (used by PDF/image previews).
|
||||
# Default is attachment so normal download buttons still save to disk.
|
||||
inline = request.args.get('inline', '0') == '1'
|
||||
return send_file(str(filepath), mimetype=f.mime_type,
|
||||
as_attachment=not inline, download_name=f.name)
|
||||
|
||||
|
||||
def _download_folder_as_zip(folder):
|
||||
|
||||
Reference in New Issue
Block a user