From 8a1e56c4ccda4b35c2187106a1a32eb663bdb5a8 Mon Sep 17 00:00:00 2001 From: MarSeventh <1193267292@qq.com> Date: Wed, 29 Jul 2026 16:36:17 +0800 Subject: [PATCH] fix: redirect Pages image transformations --- functions/file/imageTransform.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/functions/file/imageTransform.js b/functions/file/imageTransform.js index 28cfb40c..2ddb528c 100644 --- a/functions/file/imageTransform.js +++ b/functions/file/imageTransform.js @@ -115,18 +115,13 @@ export async function transformImageRequestViaUrl(context) { sourceUrl.origin ); - try { - return await fetch(new Request(transformUrl, { - method: 'GET', - headers: request.headers, - })); - } catch (error) { - console.error('URL image transformation failed:', error); - return imageTransformError( - `Image transformation failed: ${error.message || 'unknown error'}`, - 422 - ); - } + return new Response(null, { + status: 302, + headers: { + 'Location': transformUrl.toString(), + 'Cache-Control': 'private, no-store, max-age=0', + }, + }); } export async function transformImageResponse(context, response) {