diff --git a/Cargo.lock b/Cargo.lock index 56f17318aa..5ea631d7c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11253,6 +11253,7 @@ dependencies = [ "smol", "tempfile", "thiserror 1.0.69", + "urlencoding", "util", ] diff --git a/Cargo.toml b/Cargo.toml index 4f853a6204..d0145940c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -565,6 +565,7 @@ unindent = "0.2.0" unicode-segmentation = "1.10" unicode-script = "0.5.7" url = "2.2" +urlencoding = "2.1.2" uuid = { version = "1.1.2", features = ["v4", "v5", "v7", "serde"] } wasmparser = "0.221" wasm-encoder = "0.221" diff --git a/crates/feedback/Cargo.toml b/crates/feedback/Cargo.toml index 75264a970a..05577afc04 100644 --- a/crates/feedback/Cargo.toml +++ b/crates/feedback/Cargo.toml @@ -36,7 +36,7 @@ serde_json.workspace = true smol.workspace = true sysinfo.workspace = true ui.workspace = true -urlencoding = "2.1.2" +urlencoding.workspace = true util.workspace = true workspace.workspace = true zed_actions.workspace = true diff --git a/crates/remote/Cargo.toml b/crates/remote/Cargo.toml index 4bb33d6db4..43edb8cdc8 100644 --- a/crates/remote/Cargo.toml +++ b/crates/remote/Cargo.toml @@ -39,6 +39,7 @@ shlex.workspace = true smol.workspace = true tempfile.workspace = true thiserror.workspace = true +urlencoding.workspace = true util.workspace = true [dev-dependencies] diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index 0309fb5da9..d254526e18 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -203,7 +203,8 @@ impl SshConnectionOptions { anyhow::bail!("unsupported argument: {:?}", arg); } let mut input = &arg as &str; - if let Some((u, rest)) = input.split_once('@') { + // Destination might be: username1@username2@ip2@ip1 + if let Some((u, rest)) = input.rsplit_once('@') { input = rest; username = Some(u.to_string()); } @@ -238,7 +239,9 @@ impl SshConnectionOptions { pub fn ssh_url(&self) -> String { let mut result = String::from("ssh://"); if let Some(username) = &self.username { - result.push_str(username); + // Username might be: username1@username2@ip2 + let username = urlencoding::encode(username); + result.push_str(&username); result.push('@'); } result.push_str(&self.host); diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index af7eec4df7..c5e53b817b 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -124,7 +124,7 @@ time.workspace = true toolchain_selector.workspace = true ui.workspace = true url.workspace = true -urlencoding = "2.1.2" +urlencoding.workspace = true util.workspace = true uuid.workspace = true vim.workspace = true