From 230b14080e8e4717c019b720ae3cd4ce91cb93d6 Mon Sep 17 00:00:00 2001 From: T3rM1nAt0-R Date: Thu, 8 Oct 2026 17:34:02 +0000 Subject: [PATCH] fix(storage): skip the browser cache for S3 requests (#980) S3 objects change under the same URL, and servers such as rclone serve s3 answer a ranged GET with 200 instead of 206. The browser then caches the partial preview read as the full object and returns it for the next full read, which fails as an invalid fig-kiwi container. Send storage fetches with cache: 'no-store'. Co-authored-by: Niraj <16096118+T3rM1nAt0-R@users.noreply.github.com> Co-authored-by: Danila Poyarkov --- CHANGELOG.md | 1 + src/app/integrations/storage/s3/client.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb11f3c48..0d2a92f73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,6 +126,7 @@ ### Fixed +- Open S3 storage documents completely after their previews load. Storage servers that answer a preview's byte-range read with the whole-file status, such as `rclone serve s3`, left the browser holding the partial reply as the document, so the next open failed with "Invalid fig-kiwi container". Storage requests now skip the browser cache. - Keep a layer's `.fig` ID the same across saves (#890). Layers created in OpenPencil were numbered in tree order on each save until the file was reopened, so inserting a layer shifted the IDs of the layers after it; variable collections and modes could also be renumbered. - Store crash recovery snapshots of any size. Snapshots of documents over 127 MiB failed to save to IndexedDB and stayed in memory for the rest of the session. - Keep an opened `.fig` file saved until it is edited. Laying out its first page, which recomputes auto-layout sizes and positions, and showing another page for the first time, which loads its layers from the file, marked it unsaved, so closing it asked to save changes nobody made. diff --git a/src/app/integrations/storage/s3/client.ts b/src/app/integrations/storage/s3/client.ts index 0afbe21f0..161d11e92 100644 --- a/src/app/integrations/storage/s3/client.ts +++ b/src/app/integrations/storage/s3/client.ts @@ -143,6 +143,9 @@ export async function s3Request( headers: signed.headers, body: init.body ?? undefined, credentials: 'omit', + // Objects change under the same URL, and a ranged read answered with 200 would + // otherwise be cached as the whole object and returned for the next full read. + cache: 'no-store', signal: init.signal }) }