diff --git a/packages/api/src/utility/getJslFileName.js b/packages/api/src/utility/getJslFileName.js index 8c8ac4c68..439deede8 100644 --- a/packages/api/src/utility/getJslFileName.js +++ b/packages/api/src/utility/getJslFileName.js @@ -6,6 +6,10 @@ function getJslFileName(jslid) { if (archiveMatch) { return path.join(resolveArchiveFolder(archiveMatch[1]), `${archiveMatch[2]}.jsonl`); } + const fileMatch = jslid.match(/^file:\/\/(.*)$/); + if (fileMatch) { + return fileMatch[1]; + } return path.join(jsldir(), `${jslid}.jsonl`); } diff --git a/packages/web/src/plugins/fileformats.ts b/packages/web/src/plugins/fileformats.ts index e10082891..070cf5b5f 100644 --- a/packages/web/src/plugins/fileformats.ts +++ b/packages/web/src/plugins/fileformats.ts @@ -3,7 +3,8 @@ import { FileFormatDefinition, QuickExportDefinition } from 'dbgate-types'; const jsonlFormat = { storageType: 'jsonl', extension: 'jsonl', - name: 'JSON lines', + extensions: ['jsonl', 'ndjson'], + name: 'JSON lines/NDJSON', readerFunc: 'jsonLinesReader', writerFunc: 'jsonLinesWriter', }; @@ -23,7 +24,7 @@ const sqlFormat = { }; const jsonlQuickExport = { - label: 'JSON lines', + label: 'JSON lines/NDJSON', extension: 'jsonl', createWriter: fileName => ({ functionName: 'jsonLinesWriter', diff --git a/packages/web/src/tabs/ArchiveFileTab.svelte b/packages/web/src/tabs/ArchiveFileTab.svelte index 71ba9889f..dae86dd96 100644 --- a/packages/web/src/tabs/ArchiveFileTab.svelte +++ b/packages/web/src/tabs/ArchiveFileTab.svelte @@ -1,5 +1,5 @@