From 9f25cf336e2078e7ceb3a7f1fc84761f52d9e380 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 21 Jan 2020 11:41:10 -0500 Subject: [PATCH] api: always pass filename to send_file Flask will raise a TypeError if the None branch of this condition was taken. --- gitsrht/blueprints/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitsrht/blueprints/api.py b/gitsrht/blueprints/api.py index f157474..0853afa 100644 --- a/gitsrht/blueprints/api.py +++ b/gitsrht/blueprints/api.py @@ -224,7 +224,7 @@ def repo_blob_GET(username, reponame, ref, path): return send_file(BytesIO(blob.data), as_attachment=blob.is_binary, - attachment_filename=entry.name if entry else None, + attachment_filename=entry.name if entry else blob.id.hex + ".bin", mimetype="text/plain" if not blob.is_binary else "application/x-octet-stream") -- 2.38.4