Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/System.Management.Automation/engine/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1258,14 +1258,14 @@ internal static bool IsAdministrator()
internal static bool IsReservedDeviceName(string destinationPath)
{
#if !UNIX
string[] reservedDeviceNames = { "CON", "PRN", "AUX", "CLOCK$", "NUL",
string[] reservedDeviceNames = { "CON", "PRN", "AUX", "CLOCK$", "NUL", "CONIN$", "CONOUT$",
"COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
"LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
string compareName = Path.GetFileName(destinationPath);
string noExtensionCompareName = Path.GetFileNameWithoutExtension(destinationPath);

if (((compareName.Length < 3) || (compareName.Length > 6)) &&
((noExtensionCompareName.Length < 3) || (noExtensionCompareName.Length > 6)))
if (((compareName.Length < 3) || (compareName.Length > 7)) &&
((noExtensionCompareName.Length < 3) || (noExtensionCompareName.Length > 7)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not blocking. It looks to me we only need to check on noExtensionCompareName. The checking on compareName seems not needed. /cc @anmenaga @iSazonov

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I open new tracking issue #13618.

{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
@{ deviceName = 'AUX' }
@{ deviceName = 'CLOCK$' }
@{ deviceName = 'NUL' }
@{ deviceName = 'CONIN$' }
@{ deviceName = 'CONOUT$' }
@{ deviceName = 'COM0' }
@{ deviceName = 'COM1' }
@{ deviceName = 'COM2' }
Expand Down