Skip to content

Commit

Permalink
Merge pull request #49386 from nextcloud/bugfix/47658/dont-fail-preco…
Browse files Browse the repository at this point in the history
…ndition-if-unset

fix(userconfig): Don't fail the precondition if the value is not set at all
  • Loading branch information
nickvergessen authored Nov 19, 2024
2 parents 4d85f44 + 394febb commit 9b11c42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/AllConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function setUserValue($userId, $appName, $key, $value, $preCondition = nu
$userPreferences = \OCP\Server::get(IUserConfig::class);
if ($preCondition !== null) {
try {
if ($userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
if ($userPreferences->hasKey($userId, $appName, $key) && $userPreferences->getValueMixed($userId, $appName, $key) !== (string)$preCondition) {
throw new PreConditionNotMetException();
}
} catch (TypeConflictException) {
Expand Down

0 comments on commit 9b11c42

Please sign in to comment.