From c971d1d5d82f2d8b58fdec76e42f4404339ab83a Mon Sep 17 00:00:00 2001 From: mei23 Date: Sun, 23 May 2021 12:53:00 +0900 Subject: [PATCH] Fix search-by-tag --- src/server/api/endpoints/notes/search-by-tag.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/server/api/endpoints/notes/search-by-tag.ts b/src/server/api/endpoints/notes/search-by-tag.ts index 61f62dd5a6..93bfa75d3b 100644 --- a/src/server/api/endpoints/notes/search-by-tag.ts +++ b/src/server/api/endpoints/notes/search-by-tag.ts @@ -105,17 +105,13 @@ export default define(meta, async (ps, me) => { if (me) generateMutedUserQuery(query, me); if (ps.tag) { - if (!safeForSql(ps.tag)) return; - query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`); + query.andWhere(`'{"${safeForSql(ps.tag) ? normalizeForSearch(ps.tag) : 'aichan_kawaii'}"}' <@ note.tags`); } else { - let i = 0; query.andWhere(new Brackets(qb => { for (const tags of ps.query!) { qb.orWhere(new Brackets(qb => { for (const tag of tags) { - if (!safeForSql(tag)) return; - qb.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`); - i++; + qb.andWhere(`'{"${safeForSql(tag) ? normalizeForSearch(tag) : 'aichan_kawaii'}"}' <@ note.tags`); } })); }