diff --git a/mutiny-core/src/nodemanager.rs b/mutiny-core/src/nodemanager.rs index f7eb9b0c1..b66d5c434 100644 --- a/mutiny-core/src/nodemanager.rs +++ b/mutiny-core/src/nodemanager.rs @@ -59,6 +59,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; #[cfg(not(target_arch = "wasm32"))] use std::time::Instant; use std::{collections::HashMap, ops::Deref, sync::Arc}; +use url::Url; #[cfg(target_arch = "wasm32")] use web_time::Instant; @@ -2036,8 +2037,14 @@ pub fn create_lsp_config( ) -> Result, MutinyError> { match (lsp_url.clone(), lsp_connection_string.clone()) { (Some(lsp_url), None) => { - if !lsp_url.is_empty() { - Ok(Some(LspConfig::new_voltage_flow(lsp_url))) + let trimmed = lsp_url.trim().to_string(); + if !trimmed.is_empty() { + // make sure url is valid + if Url::parse(&trimmed).is_err() { + return Err(MutinyError::InvalidArgumentsError); + } + + Ok(Some(LspConfig::new_voltage_flow(trimmed))) } else { Ok(None) }