From 545f930ab3bbbff10dfe37d308d7bbcccf526d22 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 17 Sep 2025 12:33:04 -0100 Subject: [PATCH] fix(userconfig): crop configvalue at 64 before index Signed-off-by: Maxence Lange --- lib/private/Config/UserConfig.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 8db6258d52a..05018adc3f8 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -1425,8 +1425,6 @@ class UserConfig implements IUserConfig { $update = $this->connection->getQueryBuilder(); $update->update('preferences') - // emptying field 'indexed' if key is not set as indexed anymore - ->set('indexed', ($indexed) ? 'configvalue' : $update->createNamedParameter('')) ->where( $update->expr()->eq('appid', $update->createNamedParameter($app)), $update->expr()->eq('configkey', $update->createNamedParameter($key)) @@ -1434,12 +1432,15 @@ class UserConfig implements IUserConfig { // switching flags 'indexed' on and off is about adding/removing the bit value on the correct entries if ($indexed) { + $update->set('indexed', $update->func()->substring('configvalue', $update->createNamedParameter(1, IQueryBuilder::PARAM_INT), $update->createNamedParameter(64, IQueryBuilder::PARAM_INT))); $update->set('flags', $update->func()->add('flags', $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT))); $update->andWhere( $update->expr()->neq($update->expr()->castColumn( $update->expr()->bitwiseAnd('flags', self::FLAG_INDEXED), IQueryBuilder::PARAM_INT), $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT) )); } else { + // emptying field 'indexed' if key is not set as indexed anymore + $update->set('indexed', $update->createNamedParameter('')); $update->set('flags', $update->func()->subtract('flags', $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT))); $update->andWhere( $update->expr()->eq($update->expr()->castColumn(