From a1eb3e901b96455a10198ec12a7ea2b74bf62195 Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Wed, 22 Oct 2025 23:11:25 +0200 Subject: [PATCH] bugfix: exiting custom backup password text form causes yikes --- releases/Next-ChangeLog.md | 1 + shared/backups.py | 1 + testing/test_backup.py | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/releases/Next-ChangeLog.md b/releases/Next-ChangeLog.md index 0a331816..a40e077c 100644 --- a/releases/Next-ChangeLog.md +++ b/releases/Next-ChangeLog.md @@ -4,6 +4,7 @@ This lists the new changes that have not yet been published in a normal release. # Shared Improvements - Both Mk4 and Q +- Bugfix: Exiting text input of Custom Backup Password causes yikes # Mk4 Specific Changes diff --git a/shared/backups.py b/shared/backups.py index 21a7572d..ce4627f2 100644 --- a/shared/backups.py +++ b/shared/backups.py @@ -588,6 +588,7 @@ async def restore_complete(fname_or_fd, temporary=False, words=True, usb=False): if words is False: ipw = await ux_input_text("", prompt="Your Backup Password", min_len=bkpw_min_len, max_len=128) + if not pwd: return pwd.append(ipw) await done(pwd) diff --git a/testing/test_backup.py b/testing/test_backup.py index 1267bb9f..f35b7698 100644 --- a/testing/test_backup.py +++ b/testing/test_backup.py @@ -717,4 +717,31 @@ def test_restore_usb_backup(backup_system, set_seed_words, cap_story, verify_eph _, story = cap_story() assert "now reboot" in story +@pytest.mark.parametrize('tmp', [True, False]) +def test_exit_dev_backup(tmp, unit_test, goto_home, pick_menu_item, need_keypress, src_root_dir, + microsd_path, press_cancel, cap_menu, cap_story): + fname = 'backup.7z' + fn = microsd_path(fname) + shutil.copy(f'{src_root_dir}/docs/backup.7z', fn) + + if not tmp: + unit_test('devtest/clear_seed.py') + + goto_home() + pick_menu_item('Advanced/Tools') + if tmp: + pick_menu_item("Danger Zone") + pick_menu_item('I Am Developer.') + pick_menu_item('Restore Bkup') + + time.sleep(.1) + pick_menu_item(fname) + + # do not write anything just exit + # yikes + press_cancel() + time.sleep(.2) + pick_menu_item("Restore Bkup") + press_cancel() + # EOF