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
2 changes: 1 addition & 1 deletion src/code/LocalServerApiCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private FindResults FindNameHelper(string packageName, string[] tags, bool inclu
string actualPkgName = packageName;

// this regex pattern matches packageName followed by a version (4 digit or 3 with prerelease word)
string regexPattern = $"{packageName}" + @".\d+\.\d+\.\d+(?:-\w+|.\d)*.nupkg";
string regexPattern = $"{packageName}" + @".\d+\.\d+\.\d+(?:[a-zA-Z0-9-.]+|.\d)?.nupkg";
Regex rx = new Regex(regexPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
_cmdletPassedIn.WriteDebug($"package file name pattern to be searched for is: {regexPattern}");

Expand Down
12 changes: 12 additions & 0 deletions test/FindPSResourceTests/FindPSResourceLocal.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' {
$commandName = "cmd1"
$dscResourceName = "dsc1"
$prereleaseLabel = ""
$localNupkgRepo = "localNupkgRepo"
Get-NewPSResourceRepositoryFile
Register-LocalRepos
Register-LocalTestNupkgsRepo

$localRepoUriAddress = Join-Path -Path $TestDrive -ChildPath "testdir"
$tagsEscaped = @("'Test'", "'Tag2'", "'PSCommand_$cmdName'", "'PSDscResource_$dscName'")
Expand Down Expand Up @@ -319,4 +321,14 @@ Describe 'Test Find-PSResource for local repositories' -tags 'CI' {
$err.Count | Should -Not -Be 0
$err[0].FullyQualifiedErrorId | Should -BeExactly "FindTagsPackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.FindPSResource"
}

It "find package where prerelease label includes digits and period (i.e prerelease label is not just words)" {
$nupkgName = "WebView2.Avalonia"
$nupkgVersion = "1.0.1518.46"
$prereleaseLabel = "preview.230207.17"
$res = Find-PSResource -Name $nupkgName -Prerelease -Repository $localNupkgRepo
$res.Name | Should -Be $nupkgName
$res.Version | Should -Be $nupkgVersion
$res.Prerelease | Should -Be $prereleaseLabel
}
}
Binary file not shown.
Loading