From bbdcc673a2ccdf5adcfe1d9b26450efbf5a29f96 Mon Sep 17 00:00:00 2001 From: Dimitry Kolyshev Date: Wed, 28 Dec 2022 15:14:08 +0300 Subject: [PATCH] Pull request: 5270-updater-package-url Merge in DNS/adguard-home from 5270-updater-package-url to master Squashed commit of the following: commit 50ee8edb6270e750ed82b14c174f88922aff86bb Author: Dimitry Kolyshev Date: Wed Dec 28 12:21:24 2022 +0700 updater: package url --- internal/updater/check.go | 6 +++++- internal/updater/updater.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/updater/check.go b/internal/updater/check.go index 2bac6153..05a4b59c 100644 --- a/internal/updater/check.go +++ b/internal/updater/check.go @@ -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 diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 55c1d918..3d89f7dd 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -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)