Skip to content

Commit

Permalink
Removes buggy regex on downloader script
Browse files Browse the repository at this point in the history
The regex attribute has a bug in powershell PowerShell/PowerShell#3144 so I moved the validation into the body.
  • Loading branch information
atruskie committed Aug 14, 2018
1 parent e1842bb commit a7d6765
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build/download_ap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ param(
[string]$package = "Stable",

[Parameter(ParameterSetName = "GitHub", Mandatory=$true)]
[ValidatePattern('\d{2}\.\d{1,2}\.\d{1,2}\.\d{1,2}')]
[string]$version,

[Parameter(ParameterSetName = "AppVeyor", Mandatory=$true)]
[ValidatePattern("\d{1,4}")]
[string]$ci_build_number,

[Parameter()]
Expand Down Expand Up @@ -74,10 +72,18 @@ switch ($type) {
}
}
"GitHub" {
if ($version -notmatch '\d{2}\.\d{1,2}\.\d{1,2}\.\d{1,2}') {
Write-Error "The version argument '$version' did not look like a version (w.x.y.z)"
exit 1
}
$source = "github"
$exact_version = $version
}
"AppVeyor" {
if ($ci_build_number -notmatch '\d{1,4}') {
Write-Error "The ci_build_number argument '$ci_build_number' is not a valid number"
exit 1
}
$source = "appveyor"
$exact_version = $ci_build_number
}
Expand Down

0 comments on commit a7d6765

Please sign in to comment.