mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-16 17:35:58 +08:00
fix: potential unencoded query
This commit is contained in:
parent
ed9e9f43cf
commit
2941be6096
@ -58,8 +58,13 @@ export class BraveSearchService extends AsyncService {
|
||||
extraHeaders['User-Agent'] = this.threadLocal.get('userAgent');
|
||||
}
|
||||
|
||||
const encoded = { ...query };
|
||||
if (encoded.q) {
|
||||
encoded.q = (Buffer.from(encoded.q).toString('ascii') === encoded.q) ? encoded.q : encodeURIComponent(encoded.q);
|
||||
}
|
||||
|
||||
try {
|
||||
const r = await this.braveSearchHTTP.webSearch(query, { headers: extraHeaders as Record<string, string> });
|
||||
const r = await this.braveSearchHTTP.webSearch(encoded, { headers: extraHeaders as Record<string, string> });
|
||||
|
||||
return r.parsed;
|
||||
} catch (err: any) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user