From 73012b9e2ba736fcc86c7264a67c1473e3bec179 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Tue, 7 Oct 2025 15:47:47 +0200 Subject: [PATCH 1/3] chore: log gzip encoded content --- src/storage/object/get.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/storage/object/get.js b/src/storage/object/get.js index 04923694..ad97548a 100644 --- a/src/storage/object/get.js +++ b/src/storage/object/get.js @@ -31,6 +31,13 @@ export default async function getObject(env, { bucket, org, key }, head = false) if (!head) { try { const resp = await client.send(new GetObjectCommand(input)); + + if (resp.ContentEncoding === 'gzip') { + // eslint-disable-next-line no-console + console.warn('Content is gzip encoded - request might fail'); + throw new Error('Corrupted content'); + } + return { body: resp.Body, status: resp.$metadata.httpStatusCode, From 3ed062f2094eb855e22b5aa55bf2a5fa6c725bfe Mon Sep 17 00:00:00 2001 From: kptdobe Date: Tue, 7 Oct 2025 15:57:55 +0200 Subject: [PATCH 2/3] chore: c8 ignore --- src/storage/object/get.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/storage/object/get.js b/src/storage/object/get.js index ad97548a..46264e41 100644 --- a/src/storage/object/get.js +++ b/src/storage/object/get.js @@ -32,11 +32,14 @@ export default async function getObject(env, { bucket, org, key }, head = false) try { const resp = await client.send(new GetObjectCommand(input)); + // c8 ignore start if (resp.ContentEncoding === 'gzip') { + // log to track which documents are gzip encoded and run scripts to fix them // eslint-disable-next-line no-console console.warn('Content is gzip encoded - request might fail'); throw new Error('Corrupted content'); } + // c8 ignore end return { body: resp.Body, From db3c4e6bcb74e80042a243c1d6538cf6aa04dea5 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Tue, 7 Oct 2025 16:03:48 +0200 Subject: [PATCH 3/3] chore: fix c8 --- src/storage/object/get.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/object/get.js b/src/storage/object/get.js index 46264e41..9deefca5 100644 --- a/src/storage/object/get.js +++ b/src/storage/object/get.js @@ -32,14 +32,14 @@ export default async function getObject(env, { bucket, org, key }, head = false) try { const resp = await client.send(new GetObjectCommand(input)); - // c8 ignore start + /* c8 ignore start */ if (resp.ContentEncoding === 'gzip') { // log to track which documents are gzip encoded and run scripts to fix them // eslint-disable-next-line no-console console.warn('Content is gzip encoded - request might fail'); throw new Error('Corrupted content'); } - // c8 ignore end + /* c8 ignore end */ return { body: resp.Body,