fix(web): downloads aborted when switching assets in the viewer (#32663)

* fix(web): downloads aborted when switching assets in the viewer

The service worker also handled the download request, so the viewer cancelling its image urls killed the download too. Only handle image requests there.

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
(cherry picked from commit 8c3fdda7ead1a70158780e45a67a11413b208dba)
This commit is contained in:
Antonio Sarro
2026-10-27 23:12:13 +03:00
committed by Codex
parent cd28300f94
commit 3458767d66
+4 -1
View File
@@ -13,8 +13,11 @@ const handleInstall = (event: ExtendableEvent) => {
event.waitUntil(sw.skipWaiting());
};
const isImageTagRequest = (event: FetchEvent) =>
event.request.method === 'GET' && event.request.destination === 'image';
const handleFetch = (event: FetchEvent): void => {
if (event.request.method !== 'GET') {
if (!isImageTagRequest(event)) {
return;
}