8000 Help was incorrectly returning multiple instances of the same help fi… · PowerShell/PowerShell@5fdf27f · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fdf27f

Browse files
committed
Help was incorrectly returning multiple instances of the same help file if it existed under a culture path and the parent was in the search path as well
1 parent 2c812f1 commit 5fdf27f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/System.Management.Automation/help/HelpProvider.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,11 @@ internal Collection<string> GetSearchPaths()
273273
Diagnostics.Assert(searchPaths != null,
274274
"HelpSystem returned an null search path");
275275

276-
searchPaths.Add(GetDefaultShellSearchPath());
276+
string defaultShellSearchPath = GetDefaultShellSearchPath();
277+
if (!searchPaths.Contains(defaultShellSearchPath))
278+
{
279+
searchPaths.Add(defaultShellSearchPath);
280+
}
277281

278282
return searchPaths;
279283
}

src/System.Management.Automation/help/MUIFileSearcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void AddFiles(string muiDirectory, string directory, string pattern)
161161
string leafFileName = Path.GetFileName(file);
162162
string uniqueToDirectory = Path.Combine(directory, leafFileName);
163163

164-
if (!_uniqueMatches.Contains(uniqueToDirectory))
164+
if (!_result.Contains(path) && !_uniqueMatches.Contains(uniqueToDirectory))
165165
{
166166
_result.Add(path);
167167
_uniqueMatches[uniqueToDirectory] = true;

test/powershell/engine/Help/HelpSystem.Tests.ps1

Lines changed: 10 additions & 0 deletions
7012
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,13 @@ Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', '
180180
}
181181
}
182182
}
183+
184+
Describe "Validate about_help.txt under culture specific folder works" -Tags @('CI') {
185+
186+
It "Get-Help about_should should return help text and not multiple HelpInfo objects" {
187+
188+
$help = Get-Help about_should
189+
$help.count | Should Be 1
190+
$help | Should BeOfType System.String
191+
}
192+
}

0 commit comments

Comments
 (0)
0