sftp: don't retry permanent connection errors

The connection pacer in getSftpConnection used to retry every error,
so permanent failures (host key mismatch, certificate rejection, auth
failure, etc.) were looped 10 times before reporting to the user.

Switch to using fserrors.ShouldRetry which matches the pattern other
backends use so only genuinely retriable errors (timeouts, EOF,
network blips) are retried and permanent errors are surfaced
immediately.
This commit is contained in:
Nick Craig-Wood
2026-07-27 14:57:21 +01:00
parent e006d7c13f
commit 83a366beae
+1 -1
View File
@@ -824,7 +824,7 @@ func (f *Fs) getSftpConnection(ctx context.Context) (c *conn, err error) {
err = f.pacer.Call(func() (bool, error) {
c, err = f.sftpConnection(ctx)
if err != nil {
return true, err
return fserrors.ShouldRetry(err), err
}
return false, nil
})