Exclude pre-release versions as per SemVer
As SemVer can be used apps could define a release like "10.0.0-alpha". This is something that we don't support at the moment in the server and we should filter all prereleases. Ref https://github.com/nextcloud/server/pull/2307#issuecomment-262911588 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
1967b9112c
commit
29402e2c0a
|
@ -79,17 +79,18 @@ class AppFetcher extends Fetcher {
|
|||
|
||||
// Filter all compatible releases
|
||||
foreach($app['releases'] as $release) {
|
||||
// Exclude all nightly releases
|
||||
if($release['isNightly'] === false) {
|
||||
// Exclude all nightly and pre-releases
|
||||
if($release['isNightly'] === false
|
||||
&& strpos($release['version'], '-') === false) {
|
||||
// Exclude all versions not compatible with the current version
|
||||
$versionParser = new VersionParser();
|
||||
$version = $versionParser->getVersion($release['rawPlatformVersionSpec']);
|
||||
|
||||
if (
|
||||
// Major version is bigger or equals to the minimum version of the app
|
||||
version_compare($ncMajorVersion, $version->getMinimumVersion(), '>=')
|
||||
// Major version is smaller or equals to the maximum version of the app
|
||||
&& version_compare($ncMajorVersion, $version->getMaximumVersion(), '<=')) {
|
||||
&& version_compare($ncMajorVersion, $version->getMaximumVersion(), '<=')
|
||||
) {
|
||||
$releases[] = $release;
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +119,7 @@ class AppFetcher extends Fetcher {
|
|||
}
|
||||
}
|
||||
|
||||
$response['data'] = array_values($response['data']);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue