Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/lib/scheduled-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/scheduled-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`)
Expand Down
Loading