From: Markus Goetz Date: Tue, 5 May 2015 16:48:57 +0000 (+0200) Subject: Updater on OS X: Only allow if in /Applications #2931 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1803^2~119 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f07d3d069ebe7da44878cfb020f4c93581c7c4ba;p=nextcloud-desktop.git Updater on OS X: Only allow if in /Applications #2931 --- diff --git a/src/gui/updater/sparkleupdater_mac.mm b/src/gui/updater/sparkleupdater_mac.mm index 038275eba..74079f0f7 100644 --- a/src/gui/updater/sparkleupdater_mac.mm +++ b/src/gui/updater/sparkleupdater_mac.mm @@ -111,15 +111,33 @@ SparkleUpdater::~SparkleUpdater() delete d; } + +bool autoUpdaterAllowed() +{ + // See https://github.com/owncloud/client/issues/2931 + NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; + NSString *expectedPath = [NSString stringWithFormat:@"/Applications/%@", [bundlePath lastPathComponent]]; + if ([expectedPath isEqualTo:bundlePath]) { + return true; + } + qWarning() << "ERROR: We are not in /Applications, won't check for update!"; + return false; +} + + void SparkleUpdater::checkForUpdate() { - [d->updater checkForUpdates: NSApp]; + if (autoUpdaterAllowed()) { + [d->updater checkForUpdates: NSApp]; + } } void SparkleUpdater::backgroundCheckForUpdate() { qDebug() << Q_FUNC_INFO << "launching background check"; - [d->updater checkForUpdatesInBackground]; + if (autoUpdaterAllowed()) { + [d->updater checkForUpdatesInBackground]; + } } } // namespace OCC