fix: skip local PathExists check when target is remote (SFTP copy)

This commit is contained in:
vrubelroman 2026-05-13 12:43:03 +03:00
parent 7d2a2dd547
commit c598350fc5

View file

@ -2358,7 +2358,9 @@ func (m *Model) handleTransfer(kind fileOpKind) (tea.Model, tea.Cmd) {
kind, m.active, srcPane.Path, dstPane.Path, srcHasRemote, dstHasRemote, sources) kind, m.active, srcPane.Path, dstPane.Path, srcHasRemote, dstHasRemote, sources)
// Check for existing targets (fast — one Stat per top-level item) // Check for existing targets (fast — one Stat per top-level item)
// Skip when target is remote — local fs check doesn't apply.
existingTargets := 0 existingTargets := 0
if !dstHasRemote {
for _, sourcePath := range sources { for _, sourcePath := range sources {
targetPath := filepath.Join(targetDir, filepath.Base(sourcePath)) targetPath := filepath.Join(targetDir, filepath.Base(sourcePath))
exists, err := vfs.PathExists(targetPath) exists, err := vfs.PathExists(targetPath)
@ -2371,6 +2373,7 @@ func (m *Model) handleTransfer(kind fileOpKind) (tea.Model, tea.Cmd) {
existingTargets++ existingTargets++
} }
} }
}
overwrite := existingTargets > 0 overwrite := existingTargets > 0
if existingTargets > 0 && !m.cfg.Behavior.ConfirmOverwrite { if existingTargets > 0 && !m.cfg.Behavior.ConfirmOverwrite {
overwrite = true overwrite = true