修复标签过滤查询:json_each 引用别名 n.tags,修复 /api/notes?tag= 500

This commit is contained in:
2026-09-08 15:27:48 +08:00
parent fca075fffa
commit 4cba55f472
+1 -1
View File
@@ -157,7 +157,7 @@ func (s *Store) ListPublicNotes(page, pageSize int, tag string) ([]Note, int, er
args := []any{}
if tag != "" {
// json_each 参数化过滤,无拼接注入面。
where += ` AND EXISTS (SELECT 1 FROM json_each(notes.tags) je WHERE je.value = ?)`
where += ` AND EXISTS (SELECT 1 FROM json_each(n.tags) je WHERE je.value = ?)`
args = append(args, tag)
}
var total int