Fix uploader API to handle write stream errors

When the upload is aborted/abandoed because the source file is missing,
the write stream is never destroyed. This dangling write stream can
later error and cause a crash.

Instead, create the write stream on demand and nearer to pipeline() to
make sure we do 'error' handling.
This commit is contained in:
Girish Ramakrishnan
2026-01-20 22:22:02 +01:00
parent 944f163882
commit 42cefd56eb
6 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ async function upload(config, limits, backupFilePath) {
assert.strictEqual(typeof limits, 'object');
assert.strictEqual(typeof backupFilePath, 'string');
// Result: { stream, finish() callback }
// Result: { createStream(), finish() callback }
throw new BoxError(BoxError.NOT_IMPLEMENTED, 'upload is not implemented');
}