You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SFTPHookAsync lets a connection known_hosts extra override an explicit constructor path #73584
self.known_hosts has already been through os.path.expanduser() in __init__, while default_known_hosts is the literal "~/.ssh/known_hosts". The two never compare equal, so the condition is always true whenever the extra is present: a connection-level known_hosts overrides even a path passed explicitly to the constructor. SSHHookAsync gets this right — it compares against the expanded default and only falls back to the extra when the constructor left the default in place.
Expected: an explicit constructor path wins; the extra applies only when the constructor used the default — consistent with SSHHookAsync.
Regression test: construct SFTPHookAsync(known_hosts="/explicit/known_hosts"), parse a connection with {"known_hosts": "/connection/known_hosts"}, and assert /explicit/known_hosts is kept.
Pre-existing; surfaced during review of #73419 and deliberately left out of that PR's scope.
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
Hi @potiuk, I'd like to work on this issue. I'll fix the comparison in SFTPHookAsync._parse_extras() to compare against the expanded default (matching SSHHookAsync's pattern) and add the regression test as described.
Activity
abhishekmauryaKsolves commentedon Sep 23, 2026
Hi @potiuk, I'd like to work on this issue. I'll fix the comparison in SFTPHookAsync._parse_extras() to compare against the expanded default (matching SSHHookAsync's pattern) and add the regression test as described.
fix(sftp): explicit known_hosts constructor arg should win over conne…