aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-11-26 16:30:14 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2021-11-26 16:30:14 +0100
commit998144f832cb6f78f20b8cdc7e1c6bde379f9522 (patch)
tree0c6bd2e32f73ccb5857c5f9073cb44557137f698 /lib
parentd384edc9c6bbf708e621c50315c81f02400ff9a6 (diff)
downloadnextcloud-server-998144f832cb6f78f20b8cdc7e1c6bde379f9522.tar.gz
nextcloud-server-998144f832cb6f78f20b8cdc7e1c6bde379f9522.zip
Obey col length of 255 to insert and search in accounts_data
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index cbd51e71c4a..2c7641243fa 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -343,6 +343,10 @@ class AccountManager implements IAccountManager {
}
public function searchUsers(string $property, array $values): array {
+ // the value col is limited to 255 bytes. It is used for searches only.
+ $values = array_map(function (string $value) {
+ return Util::shortenMultibyteString($value, 255);
+ }, $values);
$chunks = array_chunk($values, 500);
$query = $this->connection->getQueryBuilder();
$query->select('*')
@@ -625,8 +629,11 @@ class AccountManager implements IAccountManager {
continue;
}
+ // the value col is limited to 255 bytes. It is used for searches only.
+ $value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : '';
+
$query->setParameter('name', $property['name'])
- ->setParameter('value', $property['value'] ?? '');
+ ->setParameter('value', $value);
$query->executeStatement();
}
}