From 69a4961c8a1b6c80523c1d64813ba92726724b93 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:59:17 -0300 Subject: [PATCH] Decode zfile name Closes #271 --- zwift_offline.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zwift_offline.py b/zwift_offline.py index 2eefde15..05b7bf15 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -1511,6 +1511,10 @@ def api_zfiles(): except IOError as e: logger.error("failed to create zfiles dir (%s): %s", zfiles_dir, str(e)) return '', 400 + try: + zfile.filename = zfile.filename.decode('utf-8', 'ignore') + except AttributeError: + pass with open(os.path.join(zfiles_dir, quote(zfile.filename, safe=' ')), 'wb') as fd: fd.write(zfile.file) row = Zfile.query.filter_by(folder=zfile.folder, filename=zfile.filename, player_id=current_user.player_id).first()