diff --git a/src/components/FileIcon.tsx b/src/components/FileIcon.tsx index f3808686..69a1c9a8 100644 --- a/src/components/FileIcon.tsx +++ b/src/components/FileIcon.tsx @@ -47,6 +47,7 @@ const FILE_ICON_MAP: Record = { xlsx: BsFiletypeXls, // Code json: BsFiletypeJson, + jsonl: BsFiletypeJson, md: BsFiletypeMd, }; diff --git a/src/hooks/use-file-import.tsx b/src/hooks/use-file-import.tsx index 43056ea1..baf3cd2a 100644 --- a/src/hooks/use-file-import.tsx +++ b/src/hooks/use-file-import.tsx @@ -81,6 +81,7 @@ const FILE_EXTENSIONS: Record = { yaml: "yaml", yml: "yaml", json: "json", + jsonl: "json", xml: "xml", r: "r", csv: "csv", @@ -109,6 +110,8 @@ const MIME_TYPES: Record = { "application/json": "json", "text/xml": "xml", "application/xml": "xml", + "application/x-jsonlines": "json", + "text/x-jsonlines": "json", }; function detectLanguage(filename: string, mimeType: string): string | undefined { @@ -152,6 +155,12 @@ async function processFile( return contents; } + if (file.name.endsWith(".jsonl")) { + const text = await readTextFile(file); + assertContents(text); + return formatTextContent(file.name, "application/x-jsonlines", text); + } + if (file.type === "application/markdown" || file.type === "text/markdown") { const contents = await readTextFile(file); assertContents(contents);