]> uap-core.de Git - note.git/commitdiff
remove unwrap in save_note()
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 12 Jul 2026 15:02:53 +0000 (17:02 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 12 Jul 2026 15:02:53 +0000 (17:02 +0200)
application/backend/src/backend.rs

index a7b4c3a217e485e0994bd60a2fe4c13fb32f23be..27b0357ae648b5838f196b0995602ef8a854d689 100644 (file)
@@ -480,13 +480,19 @@ impl BackendHandle {
                         .column(repository::Column::LocalPath)
                     .into_tuple::<(LocalStorageSetting, bool, Option<String>)>()
                     .one(&bhandle.backend.db).await;
-                let col = result.ok().flatten().unwrap();
+                let storage = if let Ok(okres) = result && let Some(storage) = okres {
+                    storage
+                } else {
+                    // should not happen
+                    callback(SaveNoteResult::Error(DbErr::Custom("Cannot get storage settings".to_string())));
+                    return;
+                };
 
-                if col.0 == LocalStorageSetting::FileSystem || (col.0 == LocalStorageSetting::Default && col.1) {
-                    if col.2.is_none() {
+                if storage.0 == LocalStorageSetting::FileSystem || (storage.0 == LocalStorageSetting::Default && storage.1) {
+                    if storage.2.is_none() {
                         println!("Warning: collection is configured to use local storage, but there is no local storage path configured in the repository");
                     }
-                    col.2
+                    storage.2
                 } else {
                     None
                 }