diff --git a/src/frontend/src/lib/components/FileViewerOverlay.svelte b/src/frontend/src/lib/components/FileViewerOverlay.svelte index f21f5108..f7132b45 100644 --- a/src/frontend/src/lib/components/FileViewerOverlay.svelte +++ b/src/frontend/src/lib/components/FileViewerOverlay.svelte @@ -49,6 +49,32 @@ const baseName = $derived(filename.split(/[/\\]/).pop() ?? filename); + const unopenableExtensions = [ + '.exe', + '.bin', + '.so', + '.dll', + '.msi', + '.app', + '.dmg', + '.pkg', + '.iso', + '.vmdk', + '.a', + '.lib', + '.obj', + '.o', + '.pyc', + '.pyo', + '.pyd', + '.deb', + '.rpm' + ]; + + const isUnopenable = $derived( + unopenableExtensions.some((ext) => filename.toLowerCase().endsWith(ext)) + ); + type MediaKind = 'image' | 'video' | 'audio' | 'other'; type ImageInfo = { @@ -182,7 +208,7 @@ imageSupport = null; resetHeicState(); - if (!contentUrl || contentText !== null) return; + if (!contentUrl || contentText !== null || isUnopenable) return; let cancelled = false; @@ -255,7 +281,7 @@ const toolbarActions = $derived([ { key: 'copy-text', - isVisible: contentText !== null, + isVisible: contentText !== null && !isUnopenable, label: 'Copy Text', activeLabel: 'Copied Text', icon: Copy, @@ -357,7 +383,16 @@
- {#if contentText !== null} + {#if isUnopenable} +
+
+

This file type cannot be previewed.

+

+ Binary files and executables are not supported for online viewing. +

+
+
+ {:else if contentText !== null}