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\`.
This commit is contained in:
Barrett Ruth 2026-03-18 15:38:56 -04:00
parent 499bae1975
commit 017007954d
2 changed files with 2 additions and 2 deletions

View file

@ -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