Skip to content

Commit

Permalink
Fix a bug where when comparing scans we did not correctly determine t…
Browse files Browse the repository at this point in the history
…he region from the first scan URL
  • Loading branch information
antfie committed Mar 8, 2024
1 parent 1d3aa68 commit ddf559b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ func main() {
utils.ErrorAndExitWithUsage(fmt.Sprintf("Invalid region \"%s\". Must be either \"commercial\", \"us\" or \"european\"", *region))
}

firstScanLink := *scan

if len(firstScanLink) == 0 && len(*scanA) > 0 {
firstScanLink = *scanA
}

if *region != "" &&
(strings.HasPrefix(*scan, "https://") && utils.ParseRegionFromUrl(*scan) != *region) {
utils.ErrorAndExit(fmt.Sprintf("The region from the URL (%s) does not match that specified by the command line (%s)", utils.ParseRegionFromUrl(*scan), *region), nil)
(strings.HasPrefix(*scan, "https://") && utils.ParseRegionFromUrl(firstScanLink) != *region) {
utils.ErrorAndExit(fmt.Sprintf("The region from the URL (%s) does not match that specified by the command line (%s)", utils.ParseRegionFromUrl(firstScanLink), *region), nil)
}

var regionToUse string
Expand All @@ -46,7 +52,7 @@ func main() {
if len(*region) > 0 {
regionToUse = *region
} else {
regionToUse = utils.ParseRegionFromUrl(*scan)
regionToUse = utils.ParseRegionFromUrl(firstScanLink)
}

notifyOfUpdates()
Expand Down

0 comments on commit ddf559b

Please sign in to comment.