Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix app crash when trying to restore an invalid file

Ammar Ahmedf041b92360be
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({