From 95bba50223aaa9d4ad197fa13ce9907a2866e872 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 5 Aug 2022 15:53:28 +0200 Subject: [PATCH] WebHost: fix filename rename in flask update --- WebHostLib/downloads.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WebHostLib/downloads.py b/WebHostLib/downloads.py index 0704f5d0..528cbe5e 100644 --- a/WebHostLib/downloads.py +++ b/WebHostLib/downloads.py @@ -36,14 +36,14 @@ def download_patch(room_id, patch_id): fname = f"P{patch.player_id}_{patch.player_name}_{app.jinja_env.filters['suuid'](room_id)}" \ f"{AutoPatchRegister.patch_types[patch.game].patch_file_ending}" new_file.seek(0) - return send_file(new_file, as_attachment=True, attachment_filename=fname) + return send_file(new_file, as_attachment=True, download_name=fname) else: patch_data = update_patch_data(patch.data, server=f"{app.config['PATCH_TARGET']}:{last_port}") patch_data = BytesIO(patch_data) fname = f"P{patch.player_id}_{patch.player_name}_{app.jinja_env.filters['suuid'](room_id)}." \ f"{preferred_endings[patch.game]}" - return send_file(patch_data, as_attachment=True, attachment_filename=fname) + return send_file(patch_data, as_attachment=True, download_name=fname) @app.route("/dl_spoiler/") @@ -66,7 +66,7 @@ def download_slot_file(room_id, player_id: int): from worlds.minecraft import mc_update_output fname = f"AP_{app.jinja_env.filters['suuid'](room_id)}_P{slot_data.player_id}_{slot_data.player_name}.apmc" data = mc_update_output(slot_data.data, server=app.config['PATCH_TARGET'], port=room.last_port) - return send_file(io.BytesIO(data), as_attachment=True, attachment_filename=fname) + return send_file(io.BytesIO(data), as_attachment=True, download_name=fname) elif slot_data.game == "Factorio": with zipfile.ZipFile(io.BytesIO(slot_data.data)) as zf: for name in zf.namelist(): @@ -82,7 +82,7 @@ def download_slot_file(room_id, player_id: int): fname = f"AP_{app.jinja_env.filters['suuid'](room_id)}.json" else: return "Game download not supported." - return send_file(io.BytesIO(slot_data.data), as_attachment=True, attachment_filename=fname) + return send_file(io.BytesIO(slot_data.data), as_attachment=True, download_name=fname) @app.route("/templates")