From 36fdb57878b7adba8db6a1186536fc187e73d350 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 21 Jan 2025 12:49:56 +0100 Subject: [PATCH] fix: apply byte offset on Buffer.from 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. --- lib/cache/sqlite-cache-store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cache/sqlite-cache-store.js b/lib/cache/sqlite-cache-store.js index 748016fbffd..682aac31326 100644 --- a/lib/cache/sqlite-cache-store.js +++ b/lib/cache/sqlite-cache-store.js @@ -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,