waveterm/pkg/remote
lif 0b29c49076
fix: use fspath.Base to strip Windows paths on SSH remote drag-drop (#3118)
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>
2026-03-25 13:31:01 -07:00
..
conncontroller conn error sub-codes for better classification (#2889) 2026-02-19 11:18:52 -08:00
connparse Fix connparse handling for scheme-less //... WSH shorthand URIs (#3006) 2026-03-06 17:55:55 -08:00
fileshare fix: use fspath.Base to strip Windows paths on SSH remote drag-drop (#3118) 2026-03-25 13:31:01 -07:00
connutil.go Do not allow large/recursive file transfers (for now), remove s3 and wavefile fs implementations (#2808) 2026-01-28 14:28:31 -08:00
sshagent_unix.go feat: implement SSH agent for Windows with tests (#2644) 2025-12-15 11:05:11 -08:00
sshagent_unix_test.go feat: implement SSH agent for Windows with tests (#2644) 2025-12-15 11:05:11 -08:00
sshagent_windows.go feat: implement SSH agent for Windows with tests (#2644) 2025-12-15 11:05:11 -08:00
sshagent_windows_test.go feat: implement SSH agent for Windows with tests (#2644) 2025-12-15 11:05:11 -08:00
sshclient.go conn error sub-codes for better classification (#2889) 2026-02-19 11:18:52 -08:00