Skip to content

fix(0.8.10): Fix rw_upload parameter sequencing (remote, local) - #24

Merged
flymysql merged 1 commit into
flymysql:mainfrom
nekomona:fix/rw-upload-fastput-arg-order
Aug 31, 2026
Merged

flymysql merged 1 commit into
flymysql:mainfrom
nekomona:fix/rw-upload-fastput-arg-order

Conversation

@nekomona

Copy link
Copy Markdown
Contributor

This patch should fix the previous errors in rw_upload due to incorrect parameter sequence in calling ssh2 fastPut() method.

The issue is previously hidden by that nowadays agents could come up with bypassing commands, yet they induce extra token cost and distractions. After the fix the rw_upload behaves as intended without requiring following calls.

…expects fastPut(local, remote)

Root cause of the reported bug ('ENOENT ... open C:\home\...'): rw_upload called
sftp.fastPut(rp, lp), but ssh2's contract is fastPut(LOCAL path, REMOTE path) —
the reverse of fastGet(remotePath, localPath). ssh2 therefore opened the REMOTE
path as a local file, which on Windows resolves /home/... against the current
drive, even when localPath was perfectly valid. The tool could never have worked
since its introduction. rw_push/rw_sync/rw_download use writeFile/fastGet with
correct argument order and were unaffected.

- lib/index.js: call fastPut(lp, rp); rename the SFTP wrapper params to (lp, p)
  so the argument order matches the ssh2 contract.
- test/upload.test.js (new): hermetic ssh2.Client prototype patch drives the
  real apply() + pool + SFTP wrapper and asserts fastPut receives
  (local, remote); verified to fail against the old order.
- test/helpers.js: the MemFs fastPut mock encoded the same swapped order (any
  test built on it could never catch this class of bug) - corrected to the real
  contract.
@flymysql
flymysql merged commit bd61cc4 into flymysql:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants