Skip to content

Commit

Permalink
Merge pull request #334 from Dkamps18/fix-333
Browse files Browse the repository at this point in the history
Fixed #333
  • Loading branch information
Xemdo authored Sep 2, 2024
2 parents eafe225 + 22f160e commit 44481bd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/util/version_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"
"net/http"
"os"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -89,8 +88,6 @@ func CheckForUpdatesAndPrintNotice() {

// Makes the call to Github's Releases API to check for the latest release version, and compares it to the current version.
func areWeRunningLatestVersion() (bool, string, error) {
REGEX_TAG_NAME_VERSION := regexp.MustCompile("^(?:v)(.+)") // Removes the v from the start of the tag, if it exists

client := &http.Client{
Timeout: time.Second * 2,
}
Expand Down Expand Up @@ -118,7 +115,14 @@ func areWeRunningLatestVersion() (bool, string, error) {
return false, "", err
}

latestReleaseVersion, err := vrs.NewVersion(REGEX_TAG_NAME_VERSION.FindAllStringSubmatch(obj.TagName, -1)[0][1])
var latestversion string
if strings.HasPrefix(obj.TagName, "v") {
latestversion = obj.TagName[1:]
} else {
latestversion = obj.TagName
}

latestReleaseVersion, err := vrs.NewVersion(latestversion)
if err != nil {
return false, "", err
}
Expand Down

0 comments on commit 44481bd

Please sign in to comment.