diff --git a/CHANGELOG.md b/CHANGELOG.md index 182ff05..1054d80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.19.2 (2025-01-27) +Fixed issue with files and folders containing dots in them. + # 0.19.1 (2025-01-27) Added logging for unprocessable data to help reporting. diff --git a/manifest.json b/manifest.json index a4d4043..713ceaf 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "sqlseal", "name": "SQLSeal", - "version": "0.19.1", + "version": "0.19.2", "minAppVersion": "0.15.0", "description": "Use SQL in your notes to query your vault files and CSV content.", "author": "hypersphere", diff --git a/package.json b/package.json index 2bb42da..bc18a7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sqlseal", - "version": "0.19.1", + "version": "0.19.2", "description": "A plugin for Obsidian that allows you to run SQL queries on your notes.", "main": "main.js", "scripts": { diff --git a/src/datamodel/syncStrategy/SyncStrategyFactory.ts b/src/datamodel/syncStrategy/SyncStrategyFactory.ts index 1a20a1e..3975387 100644 --- a/src/datamodel/syncStrategy/SyncStrategyFactory.ts +++ b/src/datamodel/syncStrategy/SyncStrategyFactory.ts @@ -5,18 +5,8 @@ import { MarkdownTableSyncStrategy } from "./MarkdownTableSyncStrategy"; import { JsonFileSyncStrategy } from "./JSONFileSyncStrategy"; import { ParserTableDefinition } from "./types"; import { TableDefinitionExternal } from "../repository/tableDefinitions"; +import { getFileExtension } from "src/utils/extractExtension"; -function getFileExtension(pathname: string): string | null { - - - // FIXME: splitting for now - return pathname.split('.')[1].toLowerCase() - - // const url = new URL(pathname); - // const filePath = url.pathname; - // const fileName = path.basename(filePath); - // return path.extname(fileName); -} const resolveFileStrategy = (filename: string) => { const extension = getFileExtension(filename) diff --git a/src/grammar/newParser.test.ts b/src/grammar/newParser.test.ts index 1800d87..13f0070 100644 --- a/src/grammar/newParser.test.ts +++ b/src/grammar/newParser.test.ts @@ -158,4 +158,22 @@ select * from x` ] }) }) + + it('should properly parse query with dot in their name', () => { + const q = `table x = file(3.Resources/data/file.csv) + select * from x + ` + expect(parseLanguage(q, '2025-01-01.md')).toEqual({ + queryPart: 'select * from x', + intermediateContent: '', + tables: [ + { + tableAlias: 'x', + arguments: ['3.Resources/data/file.csv'], + type: 'file', + sourceFile: '2025-01-01.md' + } + ] + }) + }) }) \ No newline at end of file diff --git a/src/utils/extractExtension.test.ts b/src/utils/extractExtension.test.ts new file mode 100644 index 0000000..500bdfd --- /dev/null +++ b/src/utils/extractExtension.test.ts @@ -0,0 +1,10 @@ +import { getFileExtension } from "./extractExtension" + +describe('extractExtension', () => { + it('should properly parse file', () => { + expect(getFileExtension('a.csv')).toEqual('csv') + expect(getFileExtension('A.CSV')).toEqual('csv') + expect(getFileExtension('a/b/c/d/e/f.csv')).toEqual('csv') + expect(getFileExtension('3.Resources/a/b/c.csv')).toEqual('csv') + }) +}) \ No newline at end of file diff --git a/src/utils/extractExtension.ts b/src/utils/extractExtension.ts new file mode 100644 index 0000000..8748736 --- /dev/null +++ b/src/utils/extractExtension.ts @@ -0,0 +1,4 @@ +export function getFileExtension(pathname: string): string | null { + const parts = pathname.split('.') + return parts[parts.length - 1].toLowerCase() +} \ No newline at end of file diff --git a/versions.json b/versions.json index cd9e614..3d51d5b 100644 --- a/versions.json +++ b/versions.json @@ -29,5 +29,6 @@ "0.18.0": "0.15.0", "0.18.1": "0.15.0", "0.19.0": "0.15.0", - "0.19.1": "0.15.0" + "0.19.1": "0.15.0", + "0.19.2": "0.15.0" } \ No newline at end of file