Skip to content

Commit a151aeb

Browse files
authored
feat: support jsonl object preview (#87)
1 parent 5ed5e55 commit a151aeb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

components/object/preview-modal.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@ import { cn } from "@/lib/utils"
99
import { RiFullscreenExitLine, RiFullscreenLine } from "@remixicon/react"
1010
import { PdfViewer } from "@/components/object/pdf-viewer"
1111

12-
const SAFE_TEXT_MIMES = ["application/json", "application/xml", "text/plain", "text/xml", "text/csv", "text/markdown"]
13-
const SAFE_TEXT_EXTENSIONS = [".txt", ".json", ".xml", ".csv", ".md", ".yml", ".yaml"]
12+
const SAFE_TEXT_MIMES = [
13+
"application/json",
14+
"application/jsonl",
15+
"application/ndjson",
16+
"application/x-ndjson",
17+
"application/xml",
18+
"text/plain",
19+
"text/xml",
20+
"text/csv",
21+
"text/markdown",
22+
]
23+
const SAFE_TEXT_EXTENSIONS = [".txt", ".json", ".jsonl", ".ndjson", ".xml", ".csv", ".md", ".yml", ".yaml"]
1424
const SAFE_IMAGE_EXTENSIONS = [".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".ico", ".tif", ".tiff"]
1525
const ALLOWED_SIZE = 1024 * 1024 * 2 // 2MB
1626

lib/mime-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export function getMimeTypeFromFilename(filename: string): string {
5151
css: "text/css",
5252
js: "application/javascript",
5353
json: "application/json",
54+
jsonl: "application/x-ndjson",
55+
ndjson: "application/x-ndjson",
5456
xml: "application/xml",
5557
wasm: "application/wasm",
5658
ttf: "font/ttf",

0 commit comments

Comments
 (0)