修复标签过滤查询:json_each 引用别名 n.tags,修复 /api/notes?tag= 500
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user