mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
During Tab Completion, skip file if can't read file attributes (#10910)
This commit is contained in:
@@ -4275,10 +4275,17 @@ namespace System.Management.Automation
|
||||
continue;
|
||||
|
||||
var fileInfo = new FileInfo(entry);
|
||||
if ((fileInfo.Attributes & FileAttributes.Hidden) != 0)
|
||||
try
|
||||
{
|
||||
PSObject wrapper = PSObject.AsPSObject(entry);
|
||||
psobjs.Add(wrapper);
|
||||
if ((fileInfo.Attributes & FileAttributes.Hidden) != 0)
|
||||
{
|
||||
PSObject wrapper = PSObject.AsPSObject(entry);
|
||||
psobjs.Add(wrapper);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing if can't get file attributes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user