From f041b92360bedb9c782cce3769ac007bb0b11fee Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Thu, 1 Jan 2026 10:15:54 +0500 Subject: [PATCH] mobile: fix app crash when trying to restore an invalid file --- .../mobile/app/screens/settings/restore-backup/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/mobile/app/screens/settings/restore-backup/index.tsx b/apps/mobile/app/screens/settings/restore-backup/index.tsx index 46dfd076d..0c1e8b6b2 100644 --- a/apps/mobile/app/screens/settings/restore-backup/index.tsx +++ b/apps/mobile/app/screens/settings/restore-backup/index.tsx @@ -95,6 +95,15 @@ const restoreBackup = async (options: { deleteFile?: boolean; }) => { try { + if ( + !options.uri.endsWith(".nnbackup") && + !options.uri.endsWith(".nnbackupz") + ) { + throw new Error( + `Invalid backup file selected. Only .nnbackup and .nnbackupz files can be restored.` + ); + } + const isLegacyBackup = options.uri.endsWith(".nnbackup"); startProgress({