Skip to content

Commit

Permalink
fix: ensure we pass an ArrayBuffer to blobStore.set and not a NodeJS …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
JakeChampion and YujohnNattrass authored Dec 10, 2024
1 parent 3a2da99 commit ebfc770
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/build/src/plugins_core/blobs_upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const coreStep: CoreStepFunction = async function ({
systemLog(`Uploading blob ${key}`)

const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath)
await blobStore.set(key, data, { metadata })
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length)
await blobStore.set(key, arrayBuffer, { metadata })
},
{ concurrency: 10 },
)
Expand Down
3 changes: 2 additions & 1 deletion packages/build/src/plugins_core/dev_blobs_upload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const coreStep: CoreStepFunction = async function ({
log(logs, `- Uploading blob ${key}`, { indent: true })
}
const { data, metadata } = await getFileWithMetadata(key, contentPath, metadataPath)
await blobStore.set(key, data, { metadata })
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.length)
await blobStore.set(key, arrayBuffer, { metadata })
},
{ concurrency: 10 },
)
Expand Down

0 comments on commit ebfc770

Please sign in to comment.