Skip to content

Commit c157a3f

Browse files
authored
🐛 Handle NuGetVersion Edge Case with repeated zeroesNugetVersion does not detect repeated zeroes in a legacy nugetversion as being legacy and does not return the correct version type, causing the install folder to be incorrect.Fixed #58
* 🐛 Handle NuGetVersion Edge Case with repeated zeroes NugetVersion does not detect repeated zeroes in a legacy nugetversion as being legacy and does not return the correct version type, causing the install folder to be incorrect. Fixed #58
1 parent 7f846f4 commit c157a3f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

ModuleFast.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ function Read-RequiredSpecFile ($RequiredSpecPath) {
18791879
}
18801880

18811881
filter Resolve-FolderVersion([NuGetVersion]$version) {
1882-
if ($version.IsLegacyVersion) {
1882+
if ($version.IsLegacyVersion -or $version.OriginalVersion -match '\d+\.\d+\.\d+\.\d+') {
18831883
return $version.version
18841884
}
18851885
[Version]::new($version.Major, $version.Minor, $version.Patch)

ModuleFast.tests.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
429429
Get-Item $installTempPath\Az.Accounts\*\Az.Accounts.psd1 | Should -Not -BeNullOrEmpty
430430
}
431431
It '4 section version numbers (VMware.PowerCLI)' {
432-
Install-ModuleFast @imfParams 'VMware.VimAutomation.Common=13.2.0.22643733'
432+
$actual = Install-ModuleFast @imfParams 'VMware.VimAutomation.Common=13.2.0.22643733' -PassThru
433433
Get-Item $installTempPath\VMware*\*\*.psd1 | ForEach-Object {
434434
$moduleFolderVersion = $_ | Split-Path | Split-Path -Leaf
435435
Import-PowerShellDataFile -Path $_.FullName | Select-Object -ExpandProperty ModuleVersion | Should -Be $moduleFolderVersion
@@ -438,6 +438,14 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
438438
| Limit-ModulePath $installTempPath
439439
| Should -HaveCount 2
440440
}
441+
It '4 section version numbers with repeated zeroes' {
442+
$actual = Install-ModuleFast @imfParams 'xDSCResourceDesigner=1.13.0.0' -PassThru
443+
$resolvedPath = Resolve-Path $actual.Location.LocalPath
444+
Split-Path $resolvedPath -Leaf | Should -Be '1.13.0.0'
445+
Get-Module xDSCResourceDesigner -ListAvailable
446+
| Limit-ModulePath $installTempPath
447+
| Should -HaveCount 1
448+
}
441449
It 'lots of dependencies (Az)' {
442450
Install-ModuleFast @imfParams 'Az'
443451
(Get-Module Az* -ListAvailable).count | Should -BeGreaterThan 10

0 commit comments

Comments
 (0)