From 43a814c78b285c20c679f192cdf0fdb56f0fd7b0 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Wed, 29 Oct 2025 16:37:53 +0100 Subject: [PATCH] fix: do not respond a 404 on error --- src/storage/object/get.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storage/object/get.js b/src/storage/object/get.js index 9deefca5..adacd953 100644 --- a/src/storage/object/get.js +++ b/src/storage/object/get.js @@ -53,7 +53,11 @@ export default async function getObject(env, { bucket, org, key }, head = false) etag: resp.ETag, }; } catch (e) { - return { body: '', status: e.$metadata?.httpStatusCode || 404, contentLength: 0 }; + if (!e.$metadata?.httpStatusCode) { + // eslint-disable-next-line no-console + console.error('Error getting object without httpStatusCode', e); + } + return { body: '', status: e.$metadata?.httpStatusCode || 500, contentLength: 0 }; } } const url = await getSignedUrl(client, new HeadObjectCommand(input), { expiresIn: 3600 });