From: Olaf Wintermann Date: Sun, 12 Jul 2026 15:02:53 +0000 (+0200) Subject: remove unwrap in save_note() X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=7c3b7e24e46d8c6a6aa6ac0e427c9cde8f6aa65c;p=note.git remove unwrap in save_note() --- diff --git a/application/backend/src/backend.rs b/application/backend/src/backend.rs index a7b4c3a..27b0357 100644 --- a/application/backend/src/backend.rs +++ b/application/backend/src/backend.rs @@ -480,13 +480,19 @@ impl BackendHandle { .column(repository::Column::LocalPath) .into_tuple::<(LocalStorageSetting, bool, Option)>() .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 }