diff --git a/src/lib/scheduled-import.test.ts b/src/lib/scheduled-import.test.ts index b4f4e91d1..ceb2e24cb 100644 --- a/src/lib/scheduled-import.test.ts +++ b/src/lib/scheduled-import.test.ts @@ -116,6 +116,27 @@ describe("scheduled import path handling", () => { ).toBe(false) }) + it("detects Windows project paths case-insensitively", () => { + expect( + isProjectManagedScheduledImportPath( + "C:/Users/Me/Wiki", + "c:\\users\\me\\wiki\\raw\\sources", + ), + ).toBe(true) + expect( + isProjectManagedScheduledImportPath( + "//Server/Share/Wiki", + "//server/share/wiki/raw/sources", + ), + ).toBe(true) + expect( + isProjectManagedScheduledImportPath( + "/Users/Me/Wiki", + "/users/me/wiki/raw/sources", + ), + ).toBe(false) + }) + it("sanitizes Windows-unsafe destination path segments with a stable suffix", () => { const dest = scheduledImportDestinationForFile( projectPath, diff --git a/src/lib/scheduled-import.ts b/src/lib/scheduled-import.ts index 0844cc5b7..8baf52fb5 100644 --- a/src/lib/scheduled-import.ts +++ b/src/lib/scheduled-import.ts @@ -105,8 +105,8 @@ function cloneDb(db: ImportDb): ImportDb { } function isPathInside(path: string, parent: string): boolean { - const normalizedPath = normalizePath(path) - const normalizedParent = normalizePath(parent).replace(/\/+$/, "") + const normalizedPath = dbDirectoryKey(path) + const normalizedParent = dbDirectoryKey(parent).replace(/\/+$/, "") return ( normalizedPath === normalizedParent || normalizedPath.startsWith(`${normalizedParent}/`)