Skip to content

Commit 6fc2255

Browse files
authored
@tus/s3-store: fix uncaught exception when cancelling an upload (#412)
1 parent ffb9f0c commit 6fc2255

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/s3-store/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,13 @@ export class S3Store extends DataStore {
262262
])
263263
}
264264

265+
const readable = fs.createReadStream(path)
266+
readable.on('error', reject)
265267
if (partSize > this.minPartSize || isFinalChunk) {
266-
await this.uploadPart(metadata, fs.createReadStream(path), partNumber)
268+
await this.uploadPart(metadata, readable, partNumber)
267269
offset += partSize
268270
} else {
269-
await this.uploadIncompletePart(incompletePartId, fs.createReadStream(path))
271+
await this.uploadIncompletePart(incompletePartId, readable)
270272
}
271273

272274
bytesUploaded += partSize

0 commit comments

Comments
 (0)