forked from mirror/misskey
Fix search-by-tag (#7531)
* Fix search-by-tag
* Revert "Fix search-by-tag"
This reverts commit c971d1d5d8
.
* Fix typo
* Remove unused var
* インジェクションは[]を返すように
This commit is contained in:
parent
7063a6925f
commit
47aaf04481
@ -104,23 +104,26 @@ export default define(meta, async (ps, me) => {
|
|||||||
generateVisibilityQuery(query, me);
|
generateVisibilityQuery(query, me);
|
||||||
if (me) generateMutedUserQuery(query, me);
|
if (me) generateMutedUserQuery(query, me);
|
||||||
|
|
||||||
|
try {
|
||||||
if (ps.tag) {
|
if (ps.tag) {
|
||||||
if (!safeForSql(ps.tag)) return;
|
if (!safeForSql(ps.tag)) throw 'Injection';
|
||||||
query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`);
|
query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`);
|
||||||
} else {
|
} else {
|
||||||
let i = 0;
|
|
||||||
query.andWhere(new Brackets(qb => {
|
query.andWhere(new Brackets(qb => {
|
||||||
for (const tags of ps.query!) {
|
for (const tags of ps.query!) {
|
||||||
qb.orWhere(new Brackets(qb => {
|
qb.orWhere(new Brackets(qb => {
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
if (!safeForSql(tag)) return;
|
if (!safeForSql(tag)) throw 'Injection';
|
||||||
qb.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`);
|
qb.andWhere(`'{"${normalizeForSearch(tag)}"}' <@ note.tags`);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e === 'Injection') return [];
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
if (ps.reply != null) {
|
if (ps.reply != null) {
|
||||||
if (ps.reply) {
|
if (ps.reply) {
|
||||||
|
Loading…
Reference in New Issue
Block a user