diff options
| author | Fuwn <[email protected]> | 2022-07-17 11:36:29 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-07-17 11:36:29 +0000 |
| commit | ca8aadf5a913f50205e37ddf25d2960ef3b9dbdb (patch) | |
| tree | d1864b87e29603661f62838bdd434f2bff3fd26c | |
| parent | feat(input.rs): add help command (diff) | |
| download | sydney-ca8aadf5a913f50205e37ddf25d2960ef3b9dbdb.tar.xz sydney-ca8aadf5a913f50205e37ddf25d2960ef3b9dbdb.zip | |
fix(input.rs): error handle open command
| -rw-r--r-- | src/input.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/input.rs b/src/input.rs index 54065ac..56a4fd7 100644 --- a/src/input.rs +++ b/src/input.rs @@ -16,7 +16,7 @@ // SPDX-License-Identifier: GPL-3.0-only use crossterm::event::KeyCode; -use url::Url; +use url::{Url}; use crate::command::Command; @@ -162,15 +162,18 @@ fn handle_editing_input( Command::Quit => return true, Command::Open(to) => if let Some(to) = to { - app.set_url( - Url::parse(&if to.starts_with("gemini://") { - to - } else { - format!("gemini://{}", to) - }) - .unwrap(), - ); - app.make_request(); + match + Url::parse(&if to.starts_with("gemini://") { + to + } else { + format!("gemini://{}", to) + }) { + Ok(url) => { + app.set_url(url); + app.make_request(); + } + Err(error) => app.error = Some(error.to_string()), + } } else { app.error = Some("No URL provided for open command".to_string()); }, |