Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

fix: preserve nested scheduled-import paths on case-insensitive Windows roots

Andrew Chena03c502f8e54
diff --git a/src/lib/scheduled-import.test.ts b/src/lib/scheduled-import.test.ts
index b4f4e91d..2404f08f 100644
--- a/src/lib/scheduled-import.test.ts
+++ b/src/lib/scheduled-import.test.ts
@@ -81,6 +81,21 @@ describe("scheduled import path handling", () => {
)
})
+ it("preserves nested relative paths when the import root differs only in case (Windows)", () => {
+ const dest = scheduledImportDestinationForFile(
+ "C:/Users/Me/Wiki",
+ "C:/Users/Me/Inbox",
+ {
+ name: "report.pdf",
+ path: "c:/users/me/inbox/sub/report.pdf",
+ },
+ )
+
+ expect(dest).toBe(
+ "C:/Users/Me/Wiki/raw/sources/scheduled-import/sub/report.pdf",
+ )
+ })
+
it("does not copy files that are already under raw/sources", () => {
const dest = scheduledImportDestinationForFile(
projectPath,
diff --git a/src/lib/scheduled-import.ts b/src/lib/scheduled-import.ts
index 0844cc5b..73426973 100644
--- a/src/lib/scheduled-import.ts
+++ b/src/lib/scheduled-import.ts
@@ -91,7 +91,12 @@ function dbFilePath(projectPath: string): string {
}
function dbDirectoryKey(importPath: string): string {
- const normalized = normalizePath(importPath)
+ return caseFoldPath(normalizePath(importPath))
+}
+
+// Windows drive-letter and UNC paths are case-insensitive; fold them for
+// comparison purposes only (never for the paths actually written to disk).
+function caseFoldPath(normalized: string): string {
return /^[A-Za-z]:\//.test(normalized) || normalized.startsWith("//")
? normalized.toLowerCase()
: normalized
@@ -256,8 +261,10 @@ export function scheduledImportDestinationForFile(
}
const importRoot = normalizePath(importPath).replace(/\/+$/, "")
+ const sourceKey = caseFoldPath(source)
+ const importRootKey = caseFoldPath(importRoot)
const relative =
- source === importRoot || !source.startsWith(`${importRoot}/`)
+ sourceKey === importRootKey || !sourceKey.startsWith(`${importRootKey}/`)
? file.name
: source.slice(importRoot.length + 1)