diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 92ed38297..7b70caac7 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -148,7 +148,7 @@ export class ProblemMainHandler extends Handler { let sort: string[]; let fail = false; let pcountRelation = 'eq'; - const category = flattenDeep(decodeURIComponent(q).split(' ') + const category = flattenDeep(q.split(' ') .filter((i) => i.startsWith('category:')) .map((i) => i.split('category:')[1]?.split(','))); const text = q.split(' ').filter((i) => !i.startsWith('category:')).join(' '); @@ -294,7 +294,7 @@ export class ProblemMainHandler extends Handler { export class ProblemRandomHandler extends Handler { @param('q', Types.Content, true) async get(domainId: string, qs = '') { - const category = flattenDeep(decodeURIComponent(qs).split(' ') + const category = flattenDeep(qs.split(' ') .filter((i) => i.startsWith('category:')) .map((i) => i.split('category:')[1]?.split(','))); const q = buildQuery(this.user); diff --git a/packages/ui-default/components/omnisearch/index.page.tsx b/packages/ui-default/components/omnisearch/index.page.tsx index 64c10b982..cbcf74e5b 100644 --- a/packages/ui-default/components/omnisearch/index.page.tsx +++ b/packages/ui-default/components/omnisearch/index.page.tsx @@ -90,7 +90,7 @@ export default new AutoloadPage('omnibar', () => { } setSearching?.(true); [{ pdocs, psdict }, udocs] = await Promise.all([ - request.get(`/d/${UiContext.domainId}/p?q=${encodeURIComponent(query)}&limit=10`), + request.get(`/d/${UiContext.domainId}/p`, { q: query, limit: 10 }), api(gql` users(search: ${query}) { _id