Skip to content

Commit

Permalink
Fix for regex for downloading Node.js
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Nov 9, 2023
1 parent 5e98716 commit d6ed17c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/system/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ func getLatestNodeVersion(version, channel string) (*string, error) {
if err != nil {
return nil, err
}
regex := regexp.MustCompile(`(?m)node-(.*)-linux-.*"`)
regex := regexp.MustCompile(`(?m)node-v(\d+.\d+.\d+)-linux-.*`)
result := regex.FindStringSubmatch(string(body))

if len(result) < 2 {
return nil, fmt.Errorf("could not find latest version for %s", version)
if v, ok := os.LookupEnv("ARK_DEBUG"); ok && v == "1" {
fmt.Printf("Body: %s\n", string(body))
}
return nil, fmt.Errorf("could not find latest version for %s, (%d), %s", version, res.StatusCode, result)
}
return &result[1], nil
}
Expand Down

0 comments on commit d6ed17c

Please sign in to comment.