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 9eb9423

Browse filesBrowse files
RafaelGSSmarco-ippolito
authored andcommitted
lib: handle superscript variants on windows device
Windows recognizes the 8-bit [ISO/IEC 8859-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) superscript digits ¹, ², and ³ as digits and treats them as valid parts of COM# and LPT# device names, making them reserved in every directory. Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #59261 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent fa5c5af commit 9eb9423
Copy full SHA for 9eb9423

File tree

Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-0
lines changed
Open diff view settings
Collapse file

‎lib/path.js‎

Copy file name to clipboardExpand all lines: lib/path.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ const WINDOWS_RESERVED_NAMES = [
7676
'CON', 'PRN', 'AUX', 'NUL',
7777
'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9',
7878
'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9',
79+
'COM\xb9', 'COM\xb2', 'COM\xb3',
80+
'LPT\xb9', 'LPT\xb2', 'LPT\xb3',
7981
];
8082

8183
function isWindowsReservedName(path, colonIndex) {
Collapse file

‎test/parallel/test-path-win32-normalize-device-names.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-path-win32-normalize-device-names.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@ const normalizeDeviceNameTests = [
4545

4646
{ input: 'COM1:', expected: '.\\COM1:.' },
4747
{ input: 'COM9:', expected: '.\\COM9:.' },
48+
{ input: 'COM¹:', expected: '.\\COM¹:.' },
49+
{ input: 'COM²:', expected: '.\\COM²:.' },
50+
{ input: 'COM³:', expected: '.\\COM³:.' },
4851
{ input: 'COM1:.\\..\\..\\foo', expected: '.\\COM1:..\\..\\foo' },
52+
{ input: 'COM¹:.\\..\\..\\foo', expected: '.\\COM¹:..\\..\\foo' },
4953
{ input: 'LPT1:', expected: '.\\LPT1:.' },
54+
{ input: 'LPT¹:', expected: '.\\LPT¹:.' },
55+
{ input: 'LPT²:', expected: '.\\LPT²:.' },
56+
{ input: 'LPT³:', expected: '.\\LPT³:.' },
5057
{ input: 'LPT9:', expected: '.\\LPT9:.' },
5158
{ input: 'LPT1:.\\..\\..\\foo', expected: '.\\LPT1:..\\..\\foo' },
59+
{ input: 'LPT¹:.\\..\\..\\foo', expected: '.\\LPT¹:..\\..\\foo' },
5260
{ input: 'LpT5:/another/path', expected: '.\\LpT5:another\\path' },
5361

5462
{ input: 'C:\\foo', expected: 'C:\\foo' },

0 commit comments

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