fix(sql-library): skip restricted folders during import

This commit is contained in:
t8y2
2026-08-02 09:33:02 +08:00
parent 329e6d20e3
commit 9b05158c9a
3 changed files with 48 additions and 14 deletions
+9
View File
@@ -13,6 +13,15 @@ test("SQL library imports use the charset-aware external SQL reader", () => {
assert.doesNotMatch(handler, /readTextFile/);
});
test("SQL library directory imports use the native pruned folder scanner", () => {
const start = source.indexOf("async function collectSqlFilesRecursively");
const end = source.indexOf("async function importDirectoryIntoLibrary", start);
const scanner = start >= 0 && end > start ? source.slice(start, end) : "";
assert.match(scanner, /await api\.listSqlFilesInFolder\(dir\)/);
assert.doesNotMatch(scanner, /@tauri-apps\/plugin-fs|readDir/);
});
test("SQL library file menu can open a file with the current tab target", () => {
assert.match(source, /label: t\("sqlLibrary\.openInCurrentDatabase"\)/);
assert.match(source, /action: \(\) => openFile\(target, "current"\)/);