Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
fix: incorrect offset in `fixUrl` function (#1184)
Szymon Marczakbc8c0a434037
diff --git a/src/utils_request.js b/src/utils_request.jsindex 9df3dfb46..273864910 100644--- a/src/utils_request.js+++ b/src/utils_request.js@@ -257,7 +257,7 @@ function fixUrl(url) {const encoded = encodeURI(Buffer.from(chunks, 'hex').toString());url = `${url.slice(0, start)}${encoded}${url.slice(index)}`;- index += encoded.length;+ index = start + encoded.length;chunks = '';}diff --git a/test/utils_request.test.js b/test/utils_request.test.jsindex 68beb6d73..6ca0c54cd 100644--- a/test/utils_request.test.js+++ b/test/utils_request.test.js@@ -109,6 +109,7 @@ describe('Apify.utils_request', () => {['%cf', '�'],['helios-–-the-primordial-sun', 'helios-–-the-primordial-sun'],['helios-%E2%80%93-the-primordial-sun', 'helios-–-the-primordial-sun'],+ ['%C3%A8----%C3%A9', 'è----é'],];test.each(testQueries)(`it works with not encoded urls: '%s' (regular)`, async (query, decoded) => {