mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-15 02:05:55 +08:00
chore: prefer ctx.URL
This commit is contained in:
parent
cf01a2c504
commit
a9855dcd3b
@ -228,9 +228,8 @@ export class CrawlerHost extends RPCHost {
|
|||||||
let chargeAmount = 0;
|
let chargeAmount = 0;
|
||||||
const crawlerOptions = ctx.method === 'GET' ? crawlerOptionsHeaderOnly : crawlerOptionsParamsAllowed;
|
const crawlerOptions = ctx.method === 'GET' ? crawlerOptionsHeaderOnly : crawlerOptionsParamsAllowed;
|
||||||
|
|
||||||
// ctx.url in Koa is still not a real URL, just the full path including search query.
|
// Use koa ctx.URL, a standard URL object to avoid node.js framework prop naming confusion
|
||||||
// ctx.path in Koa does not include the search query.
|
const targetUrl = await this.getTargetUrl(tryDecodeURIComponent(`${ctx.URL.pathname}${ctx.URL.search}`), crawlerOptions);
|
||||||
const targetUrl = await this.getTargetUrl(tryDecodeURIComponent(ctx.url), crawlerOptions);
|
|
||||||
if (!targetUrl) {
|
if (!targetUrl) {
|
||||||
return await this.getIndex(auth);
|
return await this.getIndex(auth);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user