You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { CookieJar } from 'tough-cookie';
async function testInvalidRegex() {
try {
const cookieJar = new CookieJar();
//const urlWithInvalidPath = 'https://www.google.com/Antonov++Andrii/';
const urlWithInvalidPath = 'https://www.google.com/Y+C++S+T+U+D+I+O/';
// Add a cookie to this URL
cookieJar.setCookieSync('test_cookie=value', urlWithInvalidPath);
// Try to retrieve the cookies for this URL
const cookies = cookieJar.getCookieStringSync(urlWithInvalidPath);
console.log(`Cookies for ${urlWithInvalidPath}:`, cookies);
} catch (error) {
console.error('Error:', error);
}
}
testInvalidRegex();
Error: SyntaxError: Invalid regular expression: /^/Y+C++S+T+U+D+I+O/: Nothing to repeat
at new RegExp (<anonymous>)
at pathMatch (D:\fire\test\node_modules\tough-cookie\dist\pathMatch.js:35:13)
at matchRFC (D:\fire\test\node_modules\tough-cookie\dist\memstore.js:68:51)
at D:\fire\test\node_modules\tough-cookie\dist\memstore.js:87:13
at Array.forEach (<anonymous>)
at MemoryCookieStore.findCookies (D:\fire\test\node_modules\tough-cookie\dist\memstore.js:82:17)
at CookieJar.getCookies (D:\fire\test\node_modules\tough-cookie\dist\cookie\cookieJar.js:536:15)
at CookieJar.getCookieString (D:\fire\test\node_modules\tough-cookie\dist\cookie\cookieJar.js:597:14)
at CookieJar.callSync (D:\fire\test\node_modules\tough-cookie\dist\cookie\cookieJar.js:168:16)
at CookieJar.getCookieStringSync (D:\fire\test\node_modules\tough-cookie\dist\cookie\cookieJar.js:610:22)
invalid-regex-test.ts
package.json
npm run test-invalid-regex
output:
apify/crawlee#2724
The text was updated successfully, but these errors were encountered: