From 2c319ecb243478eef7300d3440e337c65756855c Mon Sep 17 00:00:00 2001 From: AI Bot Date: Thu, 3 Sep 2026 13:19:10 +0530 Subject: [PATCH] fix(Editor): Force canvas extraction for blob URLs to avoid revoked blob errors --- src/pages/Editor.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Editor.tsx b/src/pages/Editor.tsx index 99e4002..d3a8fff 100644 --- a/src/pages/Editor.tsx +++ b/src/pages/Editor.tsx @@ -268,10 +268,13 @@ export const extractTextureUrl = (texture: any) => { if (!texture) return undefined; const img = texture.image || (texture.source && texture.source.data); if (!img) return undefined; - if (typeof img.src === 'string' && img.src.length > 0) return img.src; - if (typeof img.currentSrc === 'string' && img.currentSrc.length > 0) return img.currentSrc; + + // If we have a stable URL that isn't a blob, return it directly + if (typeof img.src === 'string' && img.src.length > 0 && !img.src.startsWith('blob:')) return img.src; + if (typeof img.currentSrc === 'string' && img.currentSrc.length > 0 && !img.currentSrc.startsWith('blob:')) return img.currentSrc; // Fallback: draw ImageBitmap or HTMLImageElement to canvas to extract data URL + // We MUST do this for blob: URLs because GLTFLoader revokes blob URLs after loading! try { const MAX = 1024; let scale = 1;