Skip to content

Commit 8ef4c79

Browse files
authored
fix: apply byte offset on Buffer.from (#4019)
Doesn't make any difference in practice as byteOffset is always going to be 0 but it's theoretically more correct and could avoid future bugs.
1 parent ee02abe commit 8ef4c79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cache/sqlite-cache-store.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ module.exports = class SqliteCacheStore {
232232
const value = this.#findValue(key)
233233
return value
234234
? {
235-
body: value.body ? Buffer.from(value.body.buffer) : undefined,
235+
body: value.body ? Buffer.from(value.body.buffer, value.body.byteOffset, value.body.byteLength) : undefined,
236236
statusCode: value.statusCode,
237237
statusMessage: value.statusMessage,
238238
headers: value.headers ? JSON.parse(value.headers) : undefined,

0 commit comments

Comments
 (0)