From 8765fbb3600227dde72ea6b761387c83d117c729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Wed, 17 Jan 2018 01:55:21 +0100 Subject: [PATCH] Fix SQL query for tag filtering --- soundboard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soundboard.py b/soundboard.py index 3b5b582..40c5dfe 100644 --- a/soundboard.py +++ b/soundboard.py @@ -170,10 +170,10 @@ WHERE button.id IN ( GROUP BY button_tags.fk_button HAVING """ - tagFilter = "\t\tSUM(CASE WHEN tag.name = \"{}\" THEN 1 ELSE 0 END) > 0" + tagFilter = "\t\tSUM(CASE WHEN tag.name = ? THEN 1 ELSE 0 END) > 0" tagFilters = " AND \n".join([tagFilter.format(tag) for tag in tags.split(",")]) query += tagFilters + "\n)" - sounds = queryDB(query) + sounds = queryDB(query, tags.split(",")) return jsonify([sound["file"].split(".")[0] for sound in sounds])