tough-cookie 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -428,7 +428,7 @@ var ParameterError = class extends Error {
428
428
  };
429
429
 
430
430
  // lib/version.ts
431
- var version = "6.0.1";
431
+ var version = "6.0.2";
432
432
 
433
433
  // lib/cookie/constants.ts
434
434
  var PrefixSecurityEnum = {
@@ -1386,17 +1386,23 @@ function getCookieContext(url) {
1386
1386
  protocol: url.protocol
1387
1387
  };
1388
1388
  } else if (typeof url === "string") {
1389
+ const parsed = new URL(url);
1390
+ let pathname = parsed.pathname;
1389
1391
  try {
1390
- return new URL(decodeURI(url));
1392
+ pathname = decodeURI(pathname);
1391
1393
  } catch {
1392
- return new URL(url);
1393
1394
  }
1395
+ return {
1396
+ hostname: parsed.hostname,
1397
+ pathname,
1398
+ protocol: parsed.protocol
1399
+ };
1394
1400
  } else {
1395
1401
  throw new ParameterError("`url` argument is not a string or URL.");
1396
1402
  }
1397
1403
  }
1398
1404
  function checkSameSiteContext(value) {
1399
- const context = String(value).toLowerCase();
1405
+ const context = value.toLowerCase();
1400
1406
  if (context === "none" || context === "lax" || context === "strict") {
1401
1407
  return context;
1402
1408
  } else {