diff options
author | Bernhard Reiter <ockham@raz.or.at> | 2014-10-03 19:32:39 +0200 |
---|---|---|
committer | Bernhard Reiter <ockham@raz.or.at> | 2014-10-14 00:06:07 +0200 |
commit | 226d7233e17b114ac86d50900f4ee778f6192d7a (patch) | |
tree | 2bbcdbfb0a68687a4db8950c1643ba2216eac0b0 /lib/private | |
parent | 7e9baafc5341bda5b8b86700f90d896b43b85185 (diff) | |
download | nextcloud-server-226d7233e17b114ac86d50900f4ee778f6192d7a.tar.gz nextcloud-server-226d7233e17b114ac86d50900f4ee778f6192d7a.zip |
In Tags::rename($from, $to), check if there already is a tag named $to.
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/tags.php | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |