From 49a90ee7d40fed1302590209973c4eb63deaa751 Mon Sep 17 00:00:00 2001 From: "Harsh Gupta (aider)" Date: Thu, 15 Aug 2024 22:43:50 +0530 Subject: [PATCH] feat: use urlToCrawl in cookie url --- backend/functions/src/cloud-functions/crawler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/functions/src/cloud-functions/crawler.ts b/backend/functions/src/cloud-functions/crawler.ts index c9a72b8..f9801a1 100644 --- a/backend/functions/src/cloud-functions/crawler.ts +++ b/backend/functions/src/cloud-functions/crawler.ts @@ -674,7 +674,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; }); } - const crawlOpts = this.configure(crawlerOptions, req); + const crawlOpts = this.configure(crawlerOptions, req, urlToCrawl); console.log('Configured crawl options:', crawlOpts); if (!ctx.req.accepts('text/plain') && ctx.req.accepts('text/event-stream')) { @@ -865,7 +865,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; } } - configure(opts: CrawlerOptions, req: Request) { + configure(opts: CrawlerOptions, req: Request, urlToCrawl: URL) { this.threadLocal.set('withGeneratedAlt', opts.withGeneratedAlt); this.threadLocal.set('withLinksSummary', opts.withLinksSummary); @@ -881,7 +881,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; (Array.isArray(req.headers['x-set-cookie']) ? req.headers['x-set-cookie'] : [req.headers['x-set-cookie']]) .map(cookie => { const [name, value] = cookie.split('='); - return { name, value, url: opts.url || req.query.url as string }; + return { name, value, url: urlToCrawl.toString() }; }) : [];