diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index 383415b79226..b454a1606eb5 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -11,12 +11,12 @@ param ( $Language = $Language.ToLower() # Regex inspired but simplified from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string -$SEMVER_REGEX = "^(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:-?(?[a-zA-Z-]*)(?:\.?(?0|[1-9]\d*)))?$" +$SEMVER_REGEX = "^(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:-?(?[a-zA-Z-]*)(?:\.?(?0|[1-9]\d*))?)?$" function ToSemVer($version){ if ($version -match $SEMVER_REGEX) { - if($matches['prelabel'] -eq $null) { + if(-not $matches['prelabel']) { # artifically provide these values for non-prereleases to enable easy sorting of them later than prereleases. $prelabel = "zzz" $prenumber = 999; @@ -24,7 +24,13 @@ function ToSemVer($version){ } else { $prelabel = $matches["prelabel"] - $prenumber = [int]$matches["prenumber"] + $prenumber = 0 + + # some older packages don't have a prenumber, should handle this + if($matches["prenumber"]){ + $prenumber = [int]$matches["prenumber"] + } + $isPre = $true; }