diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-08-02 20:59:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 20:59:16 +0200 |
commit | 200b018a2ffd7e8e3763fd74563dc73b28359eba (patch) | |
tree | b999a8d6376ec3f457fd77d370b1b54f9d500cfa | |
parent | 2a8498607a4da60d5a19d185ec03fd795d85f27e (diff) | |
parent | d44a12bb8b885752161e31ca57fa67f09964e0c7 (diff) | |
download | nextcloud-server-200b018a2ffd7e8e3763fd74563dc73b28359eba.tar.gz nextcloud-server-200b018a2ffd7e8e3763fd74563dc73b28359eba.zip |
Merge pull request #39596 from nextcloud/backport/38667/stable27
[stable27] fix(SystemTagManager): Use truncated tagName in getTag and updateTag
-rw-r--r-- | lib/private/SystemTag/SystemTagManager.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index 65046ebf000..1d5bc10fc2c 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -177,8 +177,10 @@ class SystemTagManager implements ISystemTagManager { * {@inheritdoc} */ public function getTag(string $tagName, bool $userVisible, bool $userAssignable): ISystemTag { + // Length of name column is 64 + $truncatedTagName = substr($tagName, 0, 64); $result = $this->selectTagQuery - ->setParameter('name', $tagName) + ->setParameter('name', $truncatedTagName) ->setParameter('visibility', $userVisible ? 1 : 0) ->setParameter('editable', $userAssignable ? 1 : 0) ->execute(); @@ -187,7 +189,7 @@ class SystemTagManager implements ISystemTagManager { $result->closeCursor(); if (!$row) { throw new TagNotFoundException( - 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist' + 'Tag ("' . $truncatedTagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist' ); } @@ -247,9 +249,11 @@ class SystemTagManager implements ISystemTagManager { } $beforeUpdate = array_shift($tags); + // Length of name column is 64 + $truncatedNewName = substr($newName, 0, 64); $afterUpdate = new SystemTag( $tagId, - $newName, + $truncatedNewName, $userVisible, $userAssignable ); @@ -260,7 +264,7 @@ class SystemTagManager implements ISystemTagManager { ->set('visibility', $query->createParameter('visibility')) ->set('editable', $query->createParameter('editable')) ->where($query->expr()->eq('id', $query->createParameter('tagid'))) - ->setParameter('name', $newName) + ->setParameter('name', $truncatedNewName) ->setParameter('visibility', $userVisible ? 1 : 0) ->setParameter('editable', $userAssignable ? 1 : 0) ->setParameter('tagid', $tagId); |