From b86c13d7cd9fce23997ca0e93f13d2f19a0a4e4a Mon Sep 17 00:00:00 2001 From: zhhdzhang Date: Mon, 23 Mar 2026 12:54:18 +0800 Subject: [PATCH] feat: support jsonl object preview --- components/object/preview-modal.tsx | 14 ++++++++++++-- lib/mime-types.ts | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/object/preview-modal.tsx b/components/object/preview-modal.tsx index 3819c244..87937845 100644 --- a/components/object/preview-modal.tsx +++ b/components/object/preview-modal.tsx @@ -9,8 +9,18 @@ import { cn } from "@/lib/utils" import { RiFullscreenExitLine, RiFullscreenLine } from "@remixicon/react" import { PdfViewer } from "@/components/object/pdf-viewer" -const SAFE_TEXT_MIMES = ["application/json", "application/xml", "text/plain", "text/xml", "text/csv", "text/markdown"] -const SAFE_TEXT_EXTENSIONS = [".txt", ".json", ".xml", ".csv", ".md", ".yml", ".yaml"] +const SAFE_TEXT_MIMES = [ + "application/json", + "application/jsonl", + "application/ndjson", + "application/x-ndjson", + "application/xml", + "text/plain", + "text/xml", + "text/csv", + "text/markdown", +] +const SAFE_TEXT_EXTENSIONS = [".txt", ".json", ".jsonl", ".ndjson", ".xml", ".csv", ".md", ".yml", ".yaml"] const SAFE_IMAGE_EXTENSIONS = [".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".ico", ".tif", ".tiff"] const ALLOWED_SIZE = 1024 * 1024 * 2 // 2MB diff --git a/lib/mime-types.ts b/lib/mime-types.ts index d4101012..bfc0929c 100644 --- a/lib/mime-types.ts +++ b/lib/mime-types.ts @@ -51,6 +51,8 @@ export function getMimeTypeFromFilename(filename: string): string { css: "text/css", js: "application/javascript", json: "application/json", + jsonl: "application/x-ndjson", + ndjson: "application/x-ndjson", xml: "application/xml", wasm: "application/wasm", ttf: "font/ttf",