mirror of
https://github.com/wavetermdev/waveterm
synced 2026-04-21 14:37:16 +00:00
Fixes #3079 ## Summary When dragging a local file from Windows to an SSH remote connection, the full Windows path (e.g. `D:\package\AA.tar`) was being passed to `filepath.Base` on the remote (Linux) side. Since `filepath.Base` on Linux does not recognize backslashes as separators, the full path was used as the destination filename. - In `RemoteFileCopyCommand` (`wshremote_file.go:159`), replace `filepath.Base(srcConn.Path)` with `fspath.Base(srcConn.Path)` - `fspath.Base` calls `ToSlash` before `path.Base`, converting backslashes to forward slashes first, so `D:\package\AA.tar` correctly yields `AA.tar` on any OS - Same-host copies at line 86 use `filepath.Base(srcPathCleaned)` and are unaffected — those run on the same OS where `filepath.Base` is correct ## Test Plan - Added `pkg/remote/fileshare/fspath/fspath_test.go` with table-driven tests for `fspath.Base`: - Windows path with backslashes: `D:\package\AA.tar` → `AA.tar` - Windows path with forward slashes: `D:/package/AA.tar` → `AA.tar` - Unix path: `/home/user/file.txt` → `file.txt` - Filename only: `file.txt` → `file.txt` - `go test ./pkg/remote/fileshare/fspath/...` passes Signed-off-by: majiayu000 <1835304752@qq.com> |
||
|---|---|---|
| .. | ||
| conncontroller | ||
| connparse | ||
| fileshare | ||
| connutil.go | ||
| sshagent_unix.go | ||
| sshagent_unix_test.go | ||
| sshagent_windows.go | ||
| sshagent_windows_test.go | ||
| sshclient.go | ||