trousse 2.10.0 → 2.10.1

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.
Files changed (2) hide show
  1. package/dist/urls.js +2 -1
  2. package/package.json +1 -1
package/dist/urls.js CHANGED
@@ -78,6 +78,7 @@ const percentEscapeOrLettersRegex = /%[0-9A-Fa-f]{2}|[A-Z]+/g;
78
78
  const plusRegex = /\+/g;
79
79
  const httpSchemeRegex = /^http:\/\//i;
80
80
  const httpsSchemeRegex = /^https:\/\//i;
81
+ const repeatedSlashesRegex = /(?<!:|%3a)\/{2,}/gi;
81
82
  const leadingWhitespaceChars = [
82
83
  " ",
83
84
  " ",
@@ -235,7 +236,7 @@ const normalizeUrl = (url, options) => {
235
236
  if (options.stripHash) parsed.hash = "";
236
237
  let pathname = parsed.pathname;
237
238
  if (options.normalizeEncoding) pathname = decodeAndNormalizeEncoding(pathname);
238
- if (options.collapseSlashes) pathname = pathname.replace(/\/+/g, "/");
239
+ if (options.collapseSlashes) pathname = pathname.replace(repeatedSlashesRegex, "/");
239
240
  if (options.stripTrailingSlash && pathname.length > 1 && pathname.endsWith("/")) pathname = pathname.slice(0, -1);
240
241
  parsed.pathname = pathname;
241
242
  if (options.normalizeEncoding && parsed.search.includes("%")) parsed.search = decodeAndNormalizeEncoding(parsed.search);
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "entities": "^8.1.0"
48
48
  },
49
- "version": "2.10.0"
49
+ "version": "2.10.1"
50
50
  }