Skip to content

Commit

Permalink
fix: apply byte offset on Buffer.from (#4019)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ronag authored Jan 22, 2025
1 parent ee02abe commit 8ef4c79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cache/sqlite-cache-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ module.exports = class SqliteCacheStore {
const value = this.#findValue(key)
return value
? {
body: value.body ? Buffer.from(value.body.buffer) : undefined,
body: value.body ? Buffer.from(value.body.buffer, value.body.byteOffset, value.body.byteLength) : undefined,
statusCode: value.statusCode,
statusMessage: value.statusMessage,
headers: value.headers ? JSON.parse(value.headers) : undefined,
Expand Down

0 comments on commit 8ef4c79

Please sign in to comment.