mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(preview): show image preview instead of 'Conversion complete' for blob URLs
canBrowserPreview() was checking for a file extension in blob: URLs, which have none (blob:http://localhost:1349/<uuid>). This caused the optimize-for-web live preview — which stores a blob: URL in processedUrl — to always return false and show the 'Conversion complete' fallback card instead of the BeforeAfterSlider. Fix: blob: URLs are always renderable in <img> tags; short-circuit the extension check with `if (url.startsWith('blob:')) return true` in both tool-page.tsx and multi-image-viewer.tsx.
This commit is contained in:
@@ -18,6 +18,7 @@ const BROWSER_PREVIEWABLE_EXTS = new Set([
|
||||
]);
|
||||
|
||||
function canBrowserPreview(url: string): boolean {
|
||||
if (url.startsWith("blob:")) return true;
|
||||
const ext = decodeURIComponent(url).split(".").pop()?.toLowerCase() ?? "";
|
||||
return BROWSER_PREVIEWABLE_EXTS.has(ext);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ const BROWSER_PREVIEWABLE_EXTS = new Set([
|
||||
]);
|
||||
|
||||
function canBrowserPreview(url: string, filename?: string | null): boolean {
|
||||
// For blob URLs from batch processing, check the real filename instead
|
||||
// Blob URLs are always renderable in <img> tags — no extension to check
|
||||
if (url.startsWith("blob:")) return true;
|
||||
// For batch results, check the stored filename (has extension) rather than the blob URL
|
||||
const source = filename ?? url;
|
||||
const ext = decodeURIComponent(source).split(".").pop()?.toLowerCase() ?? "";
|
||||
return BROWSER_PREVIEWABLE_EXTS.has(ext);
|
||||
|
||||
Reference in New Issue
Block a user