trousse 3.19.0 → 3.19.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
@@ -320,6 +320,7 @@ const relativeLeadChars = [
320
320
  "#"
321
321
  ];
322
322
  const localhostRegex = /^localhost(?:[:/?#]|$)/i;
323
+ const portRegex = /^\d+(?:[/?#]|$)/;
323
324
  const schemeColonRegex = /^[^/]*:/;
324
325
  const missingColonSchemeRegex = /^https?[\s=.\\]*\/\//i;
325
326
  const validUrlRegex = /^https?:\/\/(?:www\.|[a-vx-z0-9])/i;
@@ -491,7 +492,7 @@ const addMissingScheme = (url, scheme = "https") => {
491
492
  const colonIndex = url.indexOf(":");
492
493
  if (colonIndex > 0) {
493
494
  const beforeColon = url.slice(0, colonIndex);
494
- if (!beforeColon.includes(".") && !beforeColon.includes("/") && !localhostRegex.test(url)) return url;
495
+ if (!(beforeColon.includes(".") && portRegex.test(url.slice(colonIndex + 1))) && !beforeColon.includes("/") && !localhostRegex.test(url)) return url;
495
496
  }
496
497
  if (url.startsWith("//") && !url.startsWith("///")) {
497
498
  const parsed = parseUrl(`${scheme}:${url}`);
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "entities": "^9.0.0"
48
48
  },
49
- "version": "3.19.0"
49
+ "version": "3.19.1"
50
50
  }