# HG changeset patch # User Thorben Günther # Date 1664214256 -7200 # Mon Sep 26 19:44:16 2022 +0200 # Node ID b98c2b7284cc2cc24526ed0f1f61d1d218a49899 # Parent f788db80d599f7d8ebdbc801def759c8698126ee Fix flask send_file arguments The deprecated attachment_filename was removed in a recent flask release and is superseded by download_name [1]. [1]: https://github.com/pallets/flask/pull/4667 diff --git a/hgsrht/blueprints/api/data.py b/hgsrht/blueprints/api/data.py --- a/hgsrht/blueprints/api/data.py +++ b/hgsrht/blueprints/api/data.py @@ -160,5 +160,5 @@ fname = os.path.basename(path) return send_file(BytesIO(data), as_attachment=is_binary, - attachment_filename=fname, + download_name=fname, mimetype="text/plain" if not is_binary else None) diff --git a/hgsrht/blueprints/repo.py b/hgsrht/blueprints/repo.py --- a/hgsrht/blueprints/repo.py +++ b/hgsrht/blueprints/repo.py @@ -356,7 +356,7 @@ fname = os.path.basename(path) return send_file(BytesIO(data), as_attachment=is_binary, - attachment_filename=fname, + download_name=fname, mimetype="text/plain" if not is_binary else None) @repo.route("///log", defaults={"path": ""}) @@ -655,5 +655,5 @@ return send_file(f, as_attachment=True, - attachment_filename=f"{basename}.tar.gz", + download_name=f"{basename}.tar.gz", mimetype="application/tar+gzip")