From 226d7233e17b114ac86d50900f4ee778f6192d7a Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Fri, 3 Oct 2014 19:32:39 +0200 Subject: In Tags::rename($from, $to), check if there already is a tag named $to. --- lib/private/tags.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/private') diff --git a/lib/private/tags.php b/lib/private/tags.php index 82a4aa4d02f..5768f19cf21 100644 --- a/lib/private/tags.php +++ b/lib/private/tags.php @@ -344,9 +344,14 @@ class Tags implements \OCP\ITags { \OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', \OCP\Util::DEBUG); return false; } + $tag = $this->tags[$key]; + + if($this->userHasTag($to, $tag->getOwner())) { + \OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', \OCP\Util::DEBUG); + return false; + } try { - $tag = $this->tags[$key]; $tag->setName($to); $this->tags[$key] = $this->mapper->update($tag); } catch(\Exception $e) { -- cgit v1.2.3