feat: support jsonl object preview (#87)

This commit is contained in:
SavvyM
2026-03-23 13:48:04 +08:00
committed by GitHub
parent 5ed5e558ee
commit a151aebdfd
2 changed files with 14 additions and 2 deletions
+12 -2
View File
@@ -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
+2
View File
@@ -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",