Skip to content

Commit ebfc770

Browse files
fix: ensure we pass an ArrayBuffer to blobStore.set and not a NodeJS Buffer (#5927)
* fix: ensure we pass an ArrayBufferLike to blobStore.set and not a NodeJS Buffer * fix: use buffer.slice to create ArrayBuffer --------- Co-authored-by: Yujohn Nattrass <yujohn.natt@gmail.com>
1 parent 3a2da99 commit ebfc770

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/build/src/plugins_core/blobs_upload/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const coreStep: CoreStepFunction = async function ({
7272
systemLog(`Uploading blob ${key}`)
7373

7474
const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath)
75-
await blobStore.set(key, data, { metadata })
75+
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length)
76+
await blobStore.set(key, arrayBuffer, { metadata })
7677
},
7778
{ concurrency: 10 },
7879
)

packages/build/src/plugins_core/dev_blobs_upload/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ const coreStep: CoreStepFunction = async function ({
7777
log(logs, `- Uploading blob ${key}`, { indent: true })
7878
}
7979
const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath)
80-
await blobStore.set(key, data, { metadata })
80+
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length)
81+
await blobStore.set(key, arrayBuffer, { metadata })
8182
},
8283
{ concurrency: 10 },
8384
)

0 commit comments

Comments
 (0)