From e0ae268f1120ce560877c2e39891c31cd3bd0504 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 14 Dec 2023 16:52:19 +0100 Subject: [PATCH] fix(wallpaper): folders and images containing spaces --- app/src/pages/desktop/wallpaper/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/pages/desktop/wallpaper/mod.rs b/app/src/pages/desktop/wallpaper/mod.rs index 994daab..380a4b5 100644 --- a/app/src/pages/desktop/wallpaper/mod.rs +++ b/app/src/pages/desktop/wallpaper/mod.rs @@ -194,11 +194,16 @@ impl page::Page for Page { self.active_dialog = ActiveDialog::None; if let Some(selection) = selections.first() { - let path = PathBuf::from(selection.path()); + let Ok(path) = selection.to_file_path() else { + tracing::error!(path = selection.path(), "not a valid file path"); + return Command::none(); + }; match active_dialog { ActiveDialog::AddFolder => { if path.is_dir() { + tracing::info!(?path, "opening new folder"); + let _res = self.config.set_current_folder(Some(path.clone())); // Add the selected folder to the recent folders list. @@ -222,6 +227,8 @@ impl page::Page for Page { ActiveDialog::AddImage => { if path.is_file() { + tracing::info!(?path, "opening custom image"); + // Loads a single custom image and its thumbnail for display in the backgrounds view. return cosmic::command::future(async move { let result =