From 017007954da545f48bde682f7c008a6a3eab3df6 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 18 Mar 2026 15:38:56 -0400 Subject: [PATCH] fix(ssh): preserve path separators in scp:// URI construction Problem: \`url_to_scp\` passes the file path through \`util.url_escape\`, which encodes \`/\` as \`%2F\`. The resulting scp command uses a URI like \`scp://host/%2Ftmp%2Ffile\` where percent-encoded slashes are not treated as path separators, causing scp to fail with a connection error. Solution: unescape \`%2F\` back to \`/\` after encoding, so other special characters (spaces, \`%\`, etc.) remain encoded but path separators are preserved. The correct absolute-path URI form is \`scp://host//path\`. --- doc/upstream.md | 2 +- lua/oil/adapters/ssh.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/upstream.md b/doc/upstream.md index 7fdb383..71a7b9c 100644 --- a/doc/upstream.md +++ b/doc/upstream.md @@ -90,7 +90,7 @@ issues against this fork. | [#486](https://github.com/stevearc/oil.nvim/issues/486) | Directory sizes show misleading 4.1k | fixed ([#87](https://github.com/barrettruth/canola.nvim/pull/87)) | | [#492](https://github.com/stevearc/oil.nvim/issues/492) | j/k remapping question | not actionable — answered | | [#507](https://github.com/stevearc/oil.nvim/issues/507) | lacasitos.nvim conflict | not actionable — cross-plugin + Windows-only | -| [#521](https://github.com/stevearc/oil.nvim/issues/521) | oil-ssh connection issues | open | +| [#521](https://github.com/stevearc/oil.nvim/issues/521) | oil-ssh connection issues | fixed ([#178](https://github.com/barrettruth/canola.nvim/pull/178)) | | [#525](https://github.com/stevearc/oil.nvim/issues/525) | SSH adapter documentation | fixed — expanded `:help oil-adapter-ssh` ([#138](https://github.com/barrettruth/canola.nvim/pull/138)) | | [#531](https://github.com/stevearc/oil.nvim/issues/531) | Incomplete drive letters | not actionable — Windows-only | | [#533](https://github.com/stevearc/oil.nvim/issues/533) | `constrain_cursor` bug | not actionable — needs repro | diff --git a/lua/oil/adapters/ssh.lua b/lua/oil/adapters/ssh.lua index a87855b..7d9b8e7 100644 --- a/lua/oil/adapters/ssh.lua +++ b/lua/oil/adapters/ssh.lua @@ -97,7 +97,7 @@ local function url_to_scp(url) table.insert(pieces, string.format(':%d', url.port)) end table.insert(pieces, '/') - local escaped_path = util.url_escape(url.path) + local escaped_path = util.url_escape(url.path):gsub('%%2F', '/') table.insert(pieces, escaped_path) return table.concat(pieces, '') end