Skip to content

Commit f3d2761

Browse files
authored
fix(core): handle windows drive letter in a case-insensitive manner when normalizing paths (#30535)
## Current Behavior The Windows drive letter in paths could have different casing in certain circumstances. The `normalizePath` helper only considers it as PascalCase, which can result in issues when the path drive letter is actually in lowercase. ## Expected Behavior The `normalizePath` should correctly handle the Windows drive letter regardless of the casing. ## Related Issue(s) Fixes #28798
1 parent bf8848d commit f3d2761

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/nx/src/utils/path.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { joinPathFragments, normalizePath } from './path';
33
describe('normalizePath', () => {
44
it('should remove drive letters', () => {
55
expect(normalizePath('C:\\some\\path')).toEqual('/some/path');
6+
expect(normalizePath('c:\\some\\path')).toEqual('/some/path');
67
});
78

89
it('should use unix style path separators', () => {

packages/nx/src/utils/path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as path from 'path';
22
import { workspaceRoot } from './workspace-root';
33

44
function removeWindowsDriveLetter(osSpecificPath: string): string {
5-
return osSpecificPath.replace(/^[A-Z]:/, '');
5+
return osSpecificPath.replace(/^[a-zA-Z]:/, '');
66
}
77

88
/**

0 commit comments

Comments
 (0)