trousse 2.16.1 → 2.16.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.
Files changed (2) hide show
  1. package/dist/urls.js +5 -3
  2. package/package.json +1 -1
package/dist/urls.js CHANGED
@@ -183,9 +183,11 @@ const httpOrSchemeRelativeRegex = /^(?:https?:)?\/\//i;
183
183
  const slugTailRegex = /[/.-]/;
184
184
  const lostSeparatorRegex = /(?<!\s)\s+(?=[A-Za-z_][\w.-]*=)/g;
185
185
  const slashClosedValueRegex = /(=[^&/=]+)\/+(?=&|$)/g;
186
- const isGlueTail = (head, glueIndex, pathEnd) => {
186
+ const isGlueTail = (head, glueIndex, pathEnd, ownEnd) => {
187
187
  const tail = head.slice(glueIndex + 1, pathEnd).split("&")[0] ?? "";
188
- return tail.includes("=") || !slugTailRegex.test(tail);
188
+ if (tail === "" || tail.includes("=")) return true;
189
+ if (slugTailRegex.test(tail)) return false;
190
+ return head.slice(glueIndex + 1, ownEnd).includes("=");
189
191
  };
190
192
  const fixMalformedQuery = (url) => {
191
193
  if (!httpOrSchemeRelativeRegex.test(url)) return url;
@@ -202,7 +204,7 @@ const fixMalformedQuery = (url) => {
202
204
  const pathIndex = head.indexOf("/", authorityEnd);
203
205
  const pathEnd = hasMark ? markIndex : ownEnd;
204
206
  const glueIndex = pathIndex !== -1 && pathIndex < pathEnd ? head.indexOf("&", pathIndex) : -1;
205
- const isGlued = glueIndex !== -1 && glueIndex < pathEnd && isGlueTail(head, glueIndex, pathEnd);
207
+ const isGlued = glueIndex !== -1 && glueIndex < pathEnd && isGlueTail(head, glueIndex, pathEnd, ownEnd);
206
208
  if (!isGlued && !hasMark) return url;
207
209
  const queryIndex = isGlued ? glueIndex : markIndex;
208
210
  const queryStart = queryIndex + (isGlued && head[glueIndex + 1] === "?" ? 2 : 1);
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "dependencies": {
47
47
  "entities": "^8.1.0"
48
48
  },
49
- "version": "2.16.1"
49
+ "version": "2.16.2"
50
50
  }