Skip to content

Commit

Permalink
Pull request: 5270-updater-package-url
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from 5270-updater-package-url to master

Squashed commit of the following:

commit 50ee8ed
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Wed Dec 28 12:21:24 2022 +0700

    updater: package url
  • Loading branch information
Mizzick authored and heyxkhoa committed Mar 17, 2023
1 parent e278ff8 commit ab795fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/updater/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ func (u *Updater) parseVersionResponse(data []byte) (VersionInfo, error) {
info.AnnouncementURL = versionJSON["announcement_url"]

packageURL, ok := u.downloadURL(versionJSON)
info.CanAutoUpdate = aghalg.BoolToNullBool(ok && info.NewVersion != u.version)
if !ok {
return info, fmt.Errorf("version.json: packageURL not found")
}

info.CanAutoUpdate = aghalg.BoolToNullBool(info.NewVersion != u.version)

u.newVersion = info.NewVersion
u.packageURL = packageURL
Expand Down
2 changes: 1 addition & 1 deletion internal/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (u *Updater) prepare(exePath string) (err error) {

_, pkgNameOnly := filepath.Split(u.packageURL)
if pkgNameOnly == "" {
return fmt.Errorf("invalid PackageURL")
return fmt.Errorf("invalid PackageURL: %q", u.packageURL)
}

u.packageName = filepath.Join(u.updateDir, pkgNameOnly)
Expand Down

0 comments on commit ab795fc

Please sign in to comment.