mirror of
https://github.com/h-sphere/sql-seal.git
synced 2026-07-22 10:10:28 +00:00
fix: fixing issue with files and folder with dots in them
This commit is contained in:
parent
e9bee3d329
commit
dfbb5367dc
8 changed files with 40 additions and 14 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
})
|
||||
10
src/utils/extractExtension.test.ts
Normal file
10
src/utils/extractExtension.test.ts
Normal file
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
4
src/utils/extractExtension.ts
Normal file
4
src/utils/extractExtension.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export function getFileExtension(pathname: string): string | null {
|
||||
const parts = pathname.split('.')
|
||||
return parts[parts.length - 1].toLowerCase()
|
||||
}
|
||||
|
|
@ -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"
|
||||
}
|
||||
Loading…
Reference in a new issue