summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/SystemTag/SystemTagManager.php3
-rw-r--r--tests/lib/SystemTag/SystemTagManagerTest.php9
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php
index 7c21c0e004e..d0854e885eb 100644
--- a/lib/private/SystemTag/SystemTagManager.php
+++ b/lib/private/SystemTag/SystemTagManager.php
@@ -400,6 +400,9 @@ class SystemTagManager implements ISystemTagManager {
'gid' => $query->createParameter('gid'),
]);
foreach ($groupIds as $groupId) {
+ if ($groupId === '') {
+ continue;
+ }
$query->setParameter('gid', $groupId);
$query->execute();
}
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index e697e373465..61fac99ca6c 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -517,6 +517,15 @@ class SystemTagManagerTest extends TestCase {
}
/**
+ * empty groupIds should be ignored
+ */
+ public function testEmptyTagGroup() {
+ $tag1 = $this->tagManager->createTag('tag1', true, false);
+ $this->tagManager->setTagGroups($tag1, ['']);
+ $this->assertEquals([], $this->tagManager->getTagGroups($tag1));
+ }
+
+ /**
* @param ISystemTag $tag1
* @param ISystemTag $tag2
*/