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
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,7 @@ internal object GetContentReaderDynamicParameters(
out provider,
out providerInstance);

if (providerPaths.Count > 0)
{
// Get the dynamic parameters for the first resolved path

return GetContentReaderDynamicParameters(providerInstance, providerPaths[0], newContext);
}
return null;
return GetContentReaderDynamicParameters(providerInstance, path, newContext);
} // GetContentReaderDynamicParameters

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ baz
} | Should -Throw -ErrorId "InvalidOperation,Microsoft.PowerShell.Commands.GetContentCommand"
}

It "Should throw ItemNotFound when path matches no files with <variation>" -TestCases @(
@{ variation = "no additional parameters"; params = @{} },
@{ variation = "dynamic parameter" ; params = @{ Raw = $true }}
) {
param($params)

{ Get-Content -Path "/DoesNotExist*.txt" @params -ErrorAction Stop } | Should -Throw -ErrorId "ItemNotFound,Microsoft.PowerShell.Commands.GetContentCommand"
}

Context "Check Get-Content containing multi-byte chars" {
BeforeAll {
$firstLine = "Hello,World"
Expand Down