Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce7c4e2

Browse filesBrowse files
committed
fix(@angular-devkit/core): handle Windows drive letter case insensitivity in path functions
This update ensures that path-related functions in account for the case-insensitivity of drive letters on Windows systems. By addressing this inconsistency, the functionality becomes more robust and aligned with Windows filesystem behavior. Closes #27029 (cherry picked from commit adf9359)
1 parent 0412c53 commit ce7c4e2
Copy full SHA for ce7c4e2

File tree

2 files changed

+6
-5
lines changed
Filter options

2 files changed

+6
-5
lines changed

‎packages/angular_devkit/core/src/virtual-fs/path.ts

Copy file name to clipboardExpand all lines: packages/angular_devkit/core/src/virtual-fs/path.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export function noCacheNormalize(path: string): Path {
233233
// Match absolute windows path.
234234
const original = path;
235235
if (path.match(/^[A-Z]:[/\\]/i)) {
236-
path = '\\' + path[0] + '\\' + path.slice(3);
236+
path = '\\' + path[0].toUpperCase() + '\\' + path.slice(3);
237237
}
238238

239239
// We convert Windows paths as well here.

‎packages/angular_devkit/core/src/virtual-fs/path_spec.ts

Copy file name to clipboardExpand all lines: packages/angular_devkit/core/src/virtual-fs/path_spec.ts
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('path', () => {
7373
expect(normalize('\\a\\b\\c')).toBe('/a/b/c');
7474
expect(normalize('.\\a\\b\\c')).toBe('a/b/c');
7575
expect(normalize('C:\\a\\b\\c')).toBe('/C/a/b/c');
76-
expect(normalize('c:\\a\\b\\c')).toBe('/c/a/b/c');
76+
expect(normalize('c:\\a\\b\\c')).toBe('/C/a/b/c');
7777
expect(normalize('A:\\a\\b\\c')).toBe('/A/a/b/c');
7878
expect(() => normalize('A:\\..\\..')).toThrow(new InvalidPathException('A:\\..\\..'));
7979
expect(normalize('\\.\\a\\b\\c')).toBe('/a/b/c');
@@ -131,6 +131,7 @@ describe('path', () => {
131131
['/src/app/sub1/test1', '/src/app/sub2/test2', '../../sub2/test2'],
132132
['/', '/a/b/c', 'a/b/c'],
133133
['/a/b/c', '/d', '../../../d'],
134+
['E:\\abc', 'e:\\abc\\def', 'def'],
134135
];
135136

136137
for (const [from, to, result] of tests) {
@@ -161,8 +162,8 @@ describe('path', () => {
161162
});
162163

163164
it('asWindowsPath', () => {
164-
expect(asWindowsPath(normalize('c:/'))).toBe('c:\\');
165-
expect(asWindowsPath(normalize('c:/b/'))).toBe('c:\\b');
166-
expect(asWindowsPath(normalize('c:/b/c'))).toBe('c:\\b\\c');
165+
expect(asWindowsPath(normalize('c:/'))).toBe('C:\\');
166+
expect(asWindowsPath(normalize('c:/b/'))).toBe('C:\\b');
167+
expect(asWindowsPath(normalize('c:/b/c'))).toBe('C:\\b\\c');
167168
});
168169
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.