diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs index 93654b9..937ff7c 100644 --- a/src/inc/routeinc/f0cklib.mjs +++ b/src/inc/routeinc/f0cklib.mjs @@ -27,7 +27,7 @@ export default { left join "user" on "user".id = favorites.user_id where ${ db.unsafe(modequery) } - ${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` } + ${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` } ${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` } ${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` } ${ mime ? db`and items.mime ilike ${smime}` : db`` } @@ -60,7 +60,7 @@ export default { left join tags_assign ta on ta.item_id = items.id and (ta.tag_id = 1 or ta.tag_id = 2) where ${ db.unsafe(modequery) } - ${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` } + ${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` } ${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` } ${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` } ${ mime ? db`and items.mime ilike ${smime}` : db`` } @@ -121,7 +121,7 @@ export default { left join tags_assign ta on ta.item_id = items.id and (ta.tag_id = 1 or ta.tag_id = 2) where ${ db.unsafe(modequery) } - ${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` } + ${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` } ${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` } ${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` } ${ mime ? db`and items.mime ilike ${smime}` : db`` } @@ -216,7 +216,7 @@ export default { left join "user" on "user".id = favorites.user_id where ${ db.unsafe(modequery) } - ${ tag ? db`and tags.normalized ilike ${'%'+tag+'%'}` : db`` } + ${ tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db`` } ${ o.fav ? db`and "user".user ilike ${'%'+user+'%'}` : db`` } ${ user ? db`and items.username ilike ${'%'+user+'%'}` : db`` } ${ mime ? db`and items.mime ilike ${smime}` : db`` }