diff options
author | Claudio Cambra <claudio.cambra@gmail.com> | 2022-06-10 16:22:48 +0300 |
---|---|---|
committer | Claudio Cambra <claudio.cambra@gmail.com> | 2022-06-10 16:28:04 +0300 |
commit | eeafcbd05b1bd4798e917d1534ca7edfe0c8341e (patch) | |
tree | 919952c1f71fb5c0e67f863ff531b1b01d858e70 | |
parent | 2c9ede37dabd8342311e197a7c7d04bee783f27a (diff) |
Always provide Sparkle update data, fixing no valid update errorbugfix/sparkle-no-valid-update
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r-- | src/Response.php | 4 | ||||
-rw-r--r-- | tests/unit/ResponseTest.php | 24 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/Response.php b/src/Response.php index fe9fe42..30d35a4 100644 --- a/src/Response.php +++ b/src/Response.php @@ -86,11 +86,11 @@ class Response { $stable = $this->config[$this->oem]['stable'][$this->platform]; $beta = $this->config[$this->oem]['beta'][$this->platform]; - if ($this->channel == 'beta' && version_compare($stable['version'], $beta['version']) == -1) { + if ($this->channel == 'beta' && (version_compare($stable['version'], $beta['version']) == -1 || ($this->platform === 'macos' && $this->isSparkle === true))) { return $beta; } - if (version_compare($this->version, $stable['version']) == -1) { + if (version_compare($this->version, $stable['version']) == -1 || ($this->platform === 'macos' && $this->isSparkle === true)) { return $stable; } diff --git a/tests/unit/ResponseTest.php b/tests/unit/ResponseTest.php index e59f00d..420eb54 100644 --- a/tests/unit/ResponseTest.php +++ b/tests/unit/ResponseTest.php @@ -270,7 +270,7 @@ class ResponseTest extends TestCase { <owncloudclient/> ' ], - // #16 + // #16 Except for Sparkle, which always needs to know what the latest version is [ 'nextcloud', 'macos', @@ -278,13 +278,9 @@ class ResponseTest extends TestCase { 'stable', true, $config, - '<?xml version="1.0" encoding="utf-8"?> -<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/"> - <channel> - <title>Download Channel</title> - <description>Most recent changes with links to updates.</description> - <language>en</language></channel> - </rss>' + '<?xml version="1.0"?> +<owncloudclient><version>2.2.2.3472</version><versionstring>Nextcloud Client 2.2.2 (build 3472)</versionstring><downloadurl>https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg</downloadurl><sparkleDownloadUrl>https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg.tbz</sparkleDownloadUrl><signature>MC0CFQDmXR6biDmNVW7TvMh0bfPPTzCvtwIUCzASgpzYdi4lltOnwbFCeQwgDjY=</signature><length>62738920</length></owncloudclient> +' ], // #17 No updates if the version is higher [ @@ -334,7 +330,7 @@ class ResponseTest extends TestCase { <owncloudclient/> ' ], - // #21 + // #21 Again, Sparkle needs to know about the latest version [ 'nextcloud', 'macos', @@ -342,13 +338,9 @@ class ResponseTest extends TestCase { 'stable', true, $config, - '<?xml version="1.0" encoding="utf-8"?> -<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/"> - <channel> - <title>Download Channel</title> - <description>Most recent changes with links to updates.</description> - <language>en</language></channel> - </rss>' + '<?xml version="1.0"?> +<owncloudclient><version>2.2.2.3472</version><versionstring>Nextcloud Client 2.2.2 (build 3472)</versionstring><downloadurl>https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg</downloadurl><sparkleDownloadUrl>https://download.owncloud.com/desktop/stable/ownCloud-2.2.2.3472.pkg.tbz</sparkleDownloadUrl><signature>MC0CFQDmXR6biDmNVW7TvMh0bfPPTzCvtwIUCzASgpzYdi4lltOnwbFCeQwgDjY=</signature><length>62738920</length></owncloudclient> +' ], ]; } |