mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 13:01:24 +00:00
* fix(sftp): prevent corrupt uploads from oversized fastPut chunks Restore ssh2's 32KB default chunk size, verify remote size after upload, and treat stream finish (not close) as success so truncated zip/tar.gz transfers fail loudly instead of looking complete (#2022). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(sftp): wait for stream close after finish on upload fallback Address Codex review: resolving on finish alone can miss close-time server errors while the remote handle is still open. Require finish then close, and fail on premature close. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
602 B
JavaScript
17 lines
602 B
JavaScript
"use strict";
|
|
|
|
// ssh2's fastPut/fastGet send multiple SFTP read/write requests in parallel.
|
|
// Keep defaults conservative so one file transfer does not monopolize a shared
|
|
// SSH/SFTP path used by interactive terminals.
|
|
//
|
|
// chunkSize must stay at ssh2's default (32KB). Larger values (e.g. 512KB) can
|
|
// exceed what some SFTP servers accept and silently produce truncated/corrupt
|
|
// remote files — see GitHub #2022 and ssh2-sftp-client's fastPut warnings.
|
|
const TRANSFER_CHUNK_SIZE = 32 * 1024;
|
|
const TRANSFER_CONCURRENCY = 4;
|
|
|
|
module.exports = {
|
|
TRANSFER_CHUNK_SIZE,
|
|
TRANSFER_CONCURRENCY,
|
|
};
|