Merge pull request #50083 from nextcloud/bugfix/trim-tags

fix: Trim tags on adding or editing
This commit is contained in:
Ferdinand Thiessen 2025-01-22 18:11:42 +01:00 committed by GitHub
commit cddcbd1476
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -145,6 +145,7 @@ class SystemTagManager implements ISystemTagManager {
}
public function createTag(string $tagName, bool $userVisible, bool $userAssignable): ISystemTag {
$tagName = trim($tagName);
// Length of name column is 64
$truncatedTagName = substr($tagName, 0, 64);
$query = $this->connection->getQueryBuilder();
@ -199,6 +200,7 @@ class SystemTagManager implements ISystemTagManager {
$beforeUpdate = array_shift($tags);
// Length of name column is 64
$newName = trim($newName);
$truncatedNewName = substr($newName, 0, 64);
$afterUpdate = new SystemTag(
$tagId,