diff --git a/include/functions.php b/include/functions.php index 495da23f..78bc171f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5311,6 +5311,9 @@ function insert_torrent_tags($torrentId, $tagIdArr, $sync = false) if ($sync) { sql_query("delete from torrent_tags where torrent_id = $torrentId"); } + if (empty($tagIdArr)) { + return; + } $insertTagsSql = 'insert into torrent_tags (`torrent_id`, `tag_id`, `created_at`, `updated_at`) values '; $values = []; foreach ($tagIdArr as $tagId) { diff --git a/public/takeedit.php b/public/takeedit.php index 2d428baa..acfee46b 100644 --- a/public/takeedit.php +++ b/public/takeedit.php @@ -224,9 +224,7 @@ if (!empty($_POST['custom_fields'])) { * @since v1.6 */ $tagIdArr = array_filter($_POST['tags'] ?? []); -if (!empty($tagIdArr)) { - insert_torrent_tags($id, $tagIdArr, true); -} +insert_torrent_tags($id, $tagIdArr, true); if($CURUSER["id"] == $row["owner"]) {