From 20d563d737aae1abca7f3c0c1be6f1516dac0d85 Mon Sep 17 00:00:00 2001 From: iliya Date: Sun, 1 Mar 2026 08:12:55 +0200 Subject: [PATCH] fix: resolve paths in validation for Windows compatibility normalizeForCompare and isPathWithinRoot now use path.resolve() to ensure consistent drive-letter prefix on Windows. Previously path.normalize('/foo') gave '\foo' (no drive letter) while path.resolve('/foo') gives 'C:\foo', causing containment checks to fail on Windows CI. --- src/main/utils/pathValidation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/utils/pathValidation.ts b/src/main/utils/pathValidation.ts index 223be737..22290e5f 100644 --- a/src/main/utils/pathValidation.ts +++ b/src/main/utils/pathValidation.ts @@ -62,12 +62,14 @@ export interface PathValidationResult { } function normalizeForCompare(input: string, isWindows: boolean): string { - const normalized = path.normalize(input); + const normalized = path.resolve(path.normalize(input)); return isWindows ? normalized.toLowerCase() : normalized; } export function isPathWithinRoot(targetPath: string, rootPath: string): boolean { - return targetPath === rootPath || targetPath.startsWith(rootPath + path.sep); + const target = path.resolve(targetPath); + const root = path.resolve(rootPath); + return target === root || target.startsWith(root + path.sep); } function resolveRealPathIfExists(inputPath: string): string | null {