diff --git a/src/filesystem/__tests__/path-utils.test.ts b/src/filesystem/__tests__/path-utils.test.ts index 868d8f08af..5530cba1c3 100644 --- a/src/filesystem/__tests__/path-utils.test.ts +++ b/src/filesystem/__tests__/path-utils.test.ts @@ -70,6 +70,12 @@ describe('Path Utilities', () => { .toBe('/home/user/some path'); expect(normalizePath('"/usr/local/some app/"')) .toBe('/usr/local/some app'); + expect(normalizePath('/usr/local//bin/app///')) + .toBe('/usr/local/bin/app'); + expect(normalizePath('/')) + .toBe('/'); + expect(normalizePath('///')) + .toBe('/'); }); it('removes surrounding quotes', () => { diff --git a/src/filesystem/path-utils.ts b/src/filesystem/path-utils.ts index c897b9d2c7..50910b995b 100644 --- a/src/filesystem/path-utils.ts +++ b/src/filesystem/path-utils.ts @@ -55,7 +55,7 @@ export function normalizePath(p: string): string { if (isUnixPath) { // For Unix paths, just normalize without converting to Windows format // Replace double slashes with single slashes and remove trailing slashes - return p.replace(/\/+/g, '/').replace(/\/+$/, ''); + return p.replace(/\/+/g, '/').replace(/(?