From 6b5506087c0526c769cc0dd0567e75d03644448e Mon Sep 17 00:00:00 2001 From: Haileyesus <118998054+blackmammoth@users.noreply.github.com> Date: Mon, 29 Jun 2026 14:48:13 +0300 Subject: [PATCH] fix(file-viewer): open video previews in new tabs --- .../code-editor/view/subcomponents/CodeEditorMediaPreview.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/code-editor/view/subcomponents/CodeEditorMediaPreview.tsx b/src/components/code-editor/view/subcomponents/CodeEditorMediaPreview.tsx index 5c54ff0a..4573907f 100644 --- a/src/components/code-editor/view/subcomponents/CodeEditorMediaPreview.tsx +++ b/src/components/code-editor/view/subcomponents/CodeEditorMediaPreview.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; + import { authenticatedFetch } from '../../../../utils/api'; import type { CodeEditorFile } from '../../types/types'; import { getPreviewMimeType, type PreviewKind } from '../../utils/previewableFile'; @@ -88,7 +89,8 @@ export default function CodeEditorMediaPreview({ // otherwise formats like webm/ogg/flac/svg won't render. const fallbackMime = getPreviewMimeType(file.name); const isGenericType = !blob.type || blob.type === 'application/octet-stream'; - let outType = isGenericType ? (fallbackMime ?? blob.type) : blob.type; + const isMislabeledVideo = kind === 'video' && Boolean(fallbackMime) && !blob.type.startsWith('video/'); + let outType = isGenericType || isMislabeledVideo ? (fallbackMime ?? blob.type) : blob.type; if (kind === 'pdf') { // The PDF renders in a same-origin