From 21de02ea23b5440d7cf94f533be1068c9e03c81c Mon Sep 17 00:00:00 2001 From: kptdobe Date: Tue, 7 Oct 2025 15:34:22 +0200 Subject: [PATCH] fix: force deflate --- src/storage/object/get.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/storage/object/get.js b/src/storage/object/get.js index 04923694..d2c46ad0 100644 --- a/src/storage/object/get.js +++ b/src/storage/object/get.js @@ -30,7 +30,20 @@ export default async function getObject(env, { bucket, org, key }, head = false) const input = buildInput({ bucket, org, key }); if (!head) { try { + client.middlewareStack.add( + (next) => (args) => { + // eslint-disable-next-line no-param-reassign + args.request.headers['Accept-Encoding'] = 'deflate'; + return next(args); + }, + { + step: 'build', + name: 'addAcceptEncodingMetadataMiddleware', + }, + ); + const resp = await client.send(new GetObjectCommand(input)); + return { body: resp.Body, status: resp.$metadata.httpStatusCode,