Skip to content
7 changes: 5 additions & 2 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ private function getUpdateVersion() : array {
return $beta;
}

if (isset($enterprise) && $this->channel == 'enterprise' && (version_compare($this->version, $enterprise['version']) == -1 || $isMacOs)) {
return $enterprise;
if ($this->channel === 'enterprise' && isset($enterprise)) {
if (version_compare($this->version, $enterprise['version']) === -1 || $isMacOs) {
return $enterprise;
}
return []; // do not fall back to stable in case there is no enterprise update
}

if (version_compare($this->version, $stable['version']) == -1 || $isMacOs) {
Expand Down
24 changes: 20 additions & 4 deletions tests/unit/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ public function updateDataProvider(): array
<owncloudclient><version>2.2.2</version><versionstring>Nextcloud Client 2.2.2</versionstring><downloadurl>https://download.nextcloud.com/desktop/stable/Nextcloud-2.2.2-x64.AppImage</downloadurl><web>https://nextcloud.com/install/#install-clients</web></owncloudclient>
'
],
// #38 Win11 -> QT6
// #38 Win11 -> QT6 - enterprise. current version lower than enterprise => should update
[
'nextcloud',
'win32',
Expand All @@ -831,7 +831,23 @@ public function updateDataProvider(): array
<owncloudclient><version>2.2.2.6192</version><versionstring>Nextcloud Client 2.2.2 (build 6192)</versionstring><downloadurl>https://download.nextcloud.com/desktop/stable/ownCloud-2.2.2.6192-setup.exe</downloadurl></owncloudclient>
'
],
// #39 macOS 11 (legacy) on enterprise channel — gets stable-qt6.9, not enterprise
// #39 Win11 -> QT6 - enterprise. current version = current enterprise => emtpy
[
'nextcloud',
'win32',
'2.2.2.6192',
'',
"11",
"10.0.26080",
'stable',
true,
false,
$config,
'<?xml version="1.0"?>
<owncloudclient/>
'
],
// #40 macOS 11 (legacy) on enterprise channel — gets stable-qt6.9, not enterprise
[
'nextcloud',
'macos',
Expand All @@ -858,7 +874,7 @@ public function updateDataProvider(): array
</channel>
</rss>'
],
// #40 macOS 14 — not legacy, gets regular stable via sparkle
// #41 macOS 14 — not legacy, gets regular stable via sparkle
[
'nextcloud',
'macos',
Expand All @@ -885,7 +901,7 @@ public function updateDataProvider(): array
</channel>
</rss>'
],
// #41 macOS 14 — not legacy, gets regular beta via sparkle
// #42 macOS 14 — not legacy, gets regular beta via sparkle
[
'nextcloud',
'macos',
Expand Down
Loading