Skip to content

Commit b151b68

Browse files
authored
fix 0 byte file upload (#1387)
1 parent da59a11 commit b151b68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ export class TypedClient {
16581658
}
16591659

16601660
const partSize = this.calculatePartSize(size)
1661-
if (typeof stream === 'string' || Buffer.isBuffer(stream) || size <= partSize) {
1661+
if (typeof stream === 'string' || stream.readableLength === 0 || Buffer.isBuffer(stream) || size <= partSize) {
16621662
const buf = isReadableStream(stream) ? await readAsBuffer(stream) : Buffer.from(stream)
16631663
return this.uploadBuffer(bucketName, objectName, headers, buf)
16641664
}

0 commit comments

Comments
 (0)