Merge pull request #44640 from nextcloud/fix/noid/returns-real-value-on-details

fix(appconfig): returns correct value on details
This commit is contained in:
Maxence Lange 2024-04-18 07:05:15 -01:00 committed by GitHub
commit b75bb088d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -173,8 +173,8 @@ class SetConfig extends Base {
*/
$sensitive = $input->getOption('sensitive');
try {
$currSensitive = $this->appConfig->isLazy($appName, $configName);
if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'LAZY' : 'NOT LAZY')) {
$currSensitive = $this->appConfig->isSensitive($appName, $configName, null);
if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'SENSITIVE' : 'NOT SENSITIVE')) {
$sensitive = $currSensitive;
}
} catch (AppConfigUnknownKeyException) {

View File

@ -1034,14 +1034,20 @@ class AppConfig implements IAppConfig {
throw new AppConfigUnknownKeyException('unknown config key');
}
$value = $cache[$app][$key];
$sensitive = $this->isSensitive($app, $key, null);
if ($sensitive && str_starts_with($value, self::ENCRYPTION_PREFIX)) {
$value = $this->crypto->decrypt(substr($value, self::ENCRYPTION_PREFIX_LENGTH));
}
return [
'app' => $app,
'key' => $key,
'value' => $cache[$app][$key],
'value' => $value,
'type' => $type,
'lazy' => $lazy,
'typeString' => $typeString,
'sensitive' => $this->isSensitive($app, $key, null)
'sensitive' => $sensitive
];
}

View File

@ -1253,7 +1253,7 @@ class AppConfigTest extends TestCase {
[
'app' => 'sensitive-app',
'key' => 'lazy-key',
'value' => $this->baseStruct['sensitive-app']['lazy-key']['encrypted'],
'value' => 'value',
'type' => 4,
'lazy' => true,
'typeString' => 'string',