Check if a reparsepoint is a symlink before trying to get target (#9895)
This commit is contained in:
parent
df8e01e95a
commit
5bc3d15a30
1 changed files with 2 additions and 1 deletions
|
@ -2001,7 +2001,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
public static string NameString(PSObject instance)
|
||||
{
|
||||
return instance?.BaseObject is FileSystemInfo fileInfo
|
||||
? InternalSymbolicLinkLinkCodeMethods.IsReparsePoint(fileInfo)
|
||||
? (InternalSymbolicLinkLinkCodeMethods.IsReparsePoint(fileInfo) &&
|
||||
InternalSymbolicLinkLinkCodeMethods.IsNameSurrogateReparsePoint(fileInfo.FullName))
|
||||
? $"{fileInfo.Name} -> {InternalSymbolicLinkLinkCodeMethods.GetTarget(instance)}"
|
||||
: fileInfo.Name
|
||||
: string.Empty;
|
||||
|
|
Loading…
Reference in a new issue