waveterm/pkg/remote/fileshare
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
..
fspath fix: use fspath.Base to strip Windows paths on SSH remote drag-drop (#3118) 2026-03-25 13:31:01 -07:00
fsutil migrate old file streaming to new modern interface (w/ flow control) (#3096) 2026-03-24 09:59:14 -07:00
wshfs migrate old file streaming to new modern interface (w/ flow control) (#3096) 2026-03-24 09:59:14 -07:00