From 036a4efcbac0a439c5672515202b2e867d04dbc5 Mon Sep 17 00:00:00 2001 From: mulla028 Date: Mon, 3 Feb 2025 17:50:46 -0500 Subject: [PATCH 1/2] Support of .jsonl files provided --- src/hooks/use-file-import.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) 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); From 8262152178d32ccb1bd842c4f37195a28c3506ce Mon Sep 17 00:00:00 2001 From: mulla028 Date: Mon, 3 Feb 2025 18:00:39 -0500 Subject: [PATCH 2/2] jsonl file appears as json icon in modal window --- src/components/FileIcon.tsx | 1 + 1 file changed, 1 insertion(+) 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, };