From 73e36b64e64cdaf64b57cb384b13282333ad1e36 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 Feb 2021 19:31:12 +0000 Subject: [PATCH] Avoid "duplicate entry" error --- src/Model/Tag.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Tag.php b/src/Model/Tag.php index 8f132e82f..451ed687b 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -125,7 +125,9 @@ class Tag // The contact wasn't found in the system (most likely some dead account) // We ensure that we only store a single entry by overwriting the previous name Logger::info('Contact not found, updating tag', ['url' => $url, 'name' => $name]); - DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url]); + if (!DBA::exists('tag', ['name' => substr($name, 0, 96), 'url' => $url])) { + DBA::update('tag', ['name' => substr($name, 0, 96)], ['url' => $url]); + } } }