Skip to content

Commit

Permalink
Merge pull request #30890 from owncloud/stable10-fix-30724
Browse files Browse the repository at this point in the history
[Stable10] Treat any unknown app version as 0.0.1
  • Loading branch information
Vincent Petry authored Mar 26, 2018
2 parents eefba37 + 974fafa commit 5e5d265
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/private/App/CodeChecker/InfoChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class InfoChecker extends BasicEmitter {
'id',
'licence',
'name',
'version',
];
private $optionalFields = [
'bugs',
Expand All @@ -49,7 +50,6 @@ class InfoChecker extends BasicEmitter {
'remote',
'repository',
'types',
'version',
'website',
];
private $deprecatedFields = [
Expand Down
7 changes: 7 additions & 0 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ protected function loadConfigValues() {
$this->cache[$row['appid']] = [];
}

// check if installed_version matches the pattern
// one_or_more_digits-dot-one_or_more_digits-any-other-characters
if ($row['configkey'] === 'installed_version'
&& preg_match('/\d+\.\d+.*$/', $row['configvalue']) !== 1
) {
$row['configvalue'] = '0.0.1';
}
$this->cache[$row['appid']][$row['configkey']] = $row['configvalue'];
}
$result->closeCursor();
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/App/CodeChecker/InfoCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ protected function setUp() {
public function appInfoData() {
return [
['testapp-infoxml', []],
['testapp-version', []],
['testapp-version', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]],
['testapp-infoxml-version', []],
['testapp-infoxml-version-different', [['type' => 'differentVersions', 'message' => 'appinfo/version: 1.2.4 - appinfo/info.xml: 1.2.3']]],
['testapp-version-missing', []],
['testapp-version-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]],
['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]],
];
}
Expand Down

0 comments on commit 5e5d265

Please sign in to comment.