mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Return correct FileName property for Get-Item when listing alternate data streams (#18019)
This commit is contained in:
@@ -8201,8 +8201,7 @@ namespace System.Management.Automation.Internal
|
||||
AlternateStreamData data = new AlternateStreamData();
|
||||
data.Stream = findStreamData.Name;
|
||||
data.Length = findStreamData.Length;
|
||||
data.FileName = path.Replace(data.Stream, string.Empty);
|
||||
data.FileName = data.FileName.Trim(':');
|
||||
data.FileName = path;
|
||||
|
||||
alternateStreams.Add(data);
|
||||
findStreamData = new AlternateStreamNativeData();
|
||||
|
||||
@@ -111,7 +111,7 @@ Describe "Get-Item" -Tags "CI" {
|
||||
{
|
||||
return
|
||||
}
|
||||
$altStreamPath = "$TESTDRIVE/altStream.txt"
|
||||
$altStreamPath = "$TESTDRIVE\altStream.txt"
|
||||
$altStreamDirectory = "$TESTDRIVE/altstreamdir"
|
||||
$noAltStreamDirectory = "$TESTDRIVE/noaltstreamdir"
|
||||
$stringData = "test data"
|
||||
@@ -144,6 +144,10 @@ Describe "Get-Item" -Tags "CI" {
|
||||
$result = Get-Item $noAltStreamDirectory -Stream * -ErrorAction Stop
|
||||
$result | Should -BeExactly $null
|
||||
}
|
||||
It "Should return filename property correctly" -Skip:$skipNotWindows {
|
||||
$result = (Get-Item -Path $altStreamPath -Stream $streamName).FileName
|
||||
$result | Should -BeExactly $altStreamPath
|
||||
}
|
||||
}
|
||||
|
||||
Context "Registry Provider" {
|
||||
|
||||
Reference in New Issue
Block a user