From 23642fbd8580a3c3fb293abaf11a95d21074e4cc Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 19 Feb 2026 20:03:30 -0500 Subject: [PATCH] fix: Ignore browser cache for diagram extension (#11498) closes #11496 --- shared/editor/lib/FileHelper.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shared/editor/lib/FileHelper.ts b/shared/editor/lib/FileHelper.ts index db67591b72..2c6f6d210b 100644 --- a/shared/editor/lib/FileHelper.ts +++ b/shared/editor/lib/FileHelper.ts @@ -354,14 +354,20 @@ export default class FileHelper { } /** - * Converts an image URL to base64 encoded data. + * Converts an image URL to a base64 data URI string. * * @param url - the URL of the image to convert. - * @returns promise resolving to base64 string (without data URI prefix). + * @returns promise resolving to a data URI string. * @throws Error if the image cannot be fetched or converted. */ static async urlToBase64(url: string): Promise { - const response = await fetch(url); + // Use "no-store" to skip the HTTP cache entirely. Without this, the + // browser may reuse a cached response that was originally fetched by an + // tag (which omits the Origin header). S3/CloudFront can cache + // that response without Access-Control-Allow-Origin, causing a CORS + // error when fetch later tries to read the same URL with an Origin + // header. + const response = await fetch(url, { cache: "no-store" }); if (!response.ok) { throw new Error(`Failed to fetch image: ${response.statusText}`); }