mirror of
https://github.com/arabianq/pipewire-soundpad.git
synced 2026-04-28 06:21:23 +00:00
🧹 Fix unsafe unwrap on file path conversion in CLI and GUI
Replaced `.to_str().unwrap()` with `.to_string_lossy()` when converting `PathBuf` to `String` to prevent potential crashes if the path contains invalid Unicode. This change improves the robustness of both the CLI and GUI components when handling file paths. - Modified `src/bin/cli.rs` to safely handle `file_path`. - Modified `src/gui/mod.rs` to safely handle `path` in `play_file`. Co-authored-by: arabianq <55220741+arabianq@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -144,7 +144,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
Actions::Play {
|
||||
file_path,
|
||||
concurrent,
|
||||
} => Request::play(file_path.to_str().unwrap(), concurrent),
|
||||
} => Request::play(&file_path.to_string_lossy(), concurrent),
|
||||
Actions::ToggleLoop { id } => Request::toggle_loop(id),
|
||||
},
|
||||
Commands::Get { parameter } => match parameter {
|
||||
|
||||
Reference in New Issue
Block a user