From b211d591b138b348fc65ea20b370f1894b2edcc6 Mon Sep 17 00:00:00 2001 From: Iva Horn Date: Mon, 30 Mar 2026 17:24:47 +0200 Subject: [PATCH] fix(macOS): guard checkForUpdatesInBackground on Sparkle's automaticallyChecksForUpdates fix(macOS): guard checkForUpdatesInBackground on Sparkle's automaticallyChecksForUpdates Fixes #9662 - Only checkForUpdatesInBackground when automaticallyChecksForUpdates Prevents calling -[SPUUpdater checkForUpdatesInBackground] when Sparkle's automaticallyChecksForUpdates is NO, which caused incorrect behavior and a Sparkle console warning (fixes #9662). Also refactors backgroundCheckForUpdate() into guard-style early returns so each condition produces its own precise log message. Signed-off-by: Iva Horn [skip ci] --- src/gui/updater/sparkleupdater_mac.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gui/updater/sparkleupdater_mac.mm b/src/gui/updater/sparkleupdater_mac.mm index 4dcf33e7f43bd..50cec1e721d2b 100644 --- a/src/gui/updater/sparkleupdater_mac.mm +++ b/src/gui/updater/sparkleupdater_mac.mm @@ -265,6 +265,7 @@ - (NSString *)feedURLStringForUpdater:(SPUUpdater *)updater // See https://github.com/owncloud/client/issues/2931 NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; NSString *expectedPath = [NSString stringWithFormat:@"/Applications/%@", [bundlePath lastPathComponent]]; + if (![expectedPath isEqualTo:bundlePath]) { qCWarning(lcUpdater) << "We are not in /Applications, won't check for update!"; return false; @@ -294,6 +295,21 @@ - (NSString *)feedURLStringForUpdater:(SPUUpdater *)updater } else { qCInfo(OCC::lcUpdater) << "not launching background check, auto updater not allowed or update check skipped in config"; } + + const ConfigFile config; + + if (!config.autoUpdateCheck()) { + qCInfo(OCC::lcUpdater) << "not launching background check, update check skipped in config"; + return; + } + + if (!_interface->updaterController.updater.automaticallyChecksForUpdates) { + qCInfo(OCC::lcUpdater) << "not launching background check, automaticallyChecksForUpdates is disabled"; + return; + } + + qCInfo(OCC::lcUpdater) << "launching background check"; + [_interface->updaterController.updater checkForUpdatesInBackground]; } QString SparkleUpdater::statusString() const