summaryrefslogtreecommitdiff
path: root/ext/url
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-10-02 09:02:46 -0700
committerGitHub <noreply@github.com>2024-10-02 09:02:46 -0700
commit1837aed79b77b3137563d4730d02e466c85b2b87 (patch)
tree09c2fbe99033c4da32d75eeb1b66790c30d3b134 /ext/url
parent18beb13f0ea750ba36b7f062f3cfdcc08c610431 (diff)
Revert "fix(urlpattern): fallback to empty string for undefined group values" (#25961)
Diffstat (limited to 'ext/url')
-rw-r--r--ext/url/01_urlpattern.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js
index 58a6d6bce..6e2756308 100644
--- a/ext/url/01_urlpattern.js
+++ b/ext/url/01_urlpattern.js
@@ -31,6 +31,7 @@ import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
const _components = Symbol("components");
+const urlPatternSettings = { groupStringFallback: false };
/**
* @typedef Components
@@ -349,7 +350,11 @@ class URLPattern {
const groups = res.groups;
for (let i = 0; i < groupList.length; ++i) {
// TODO(lucacasonato): this is vulnerable to override mistake
- groups[groupList[i]] = match[i + 1] ?? ""; // TODO(@crowlKats): remove fallback for 2.0
+ if (urlPatternSettings.groupStringFallback) {
+ groups[groupList[i]] = match[i + 1] ?? "";
+ } else {
+ groups[groupList[i]] = match[i + 1];
+ }
}
break;
}
@@ -422,4 +427,4 @@ webidl.converters.URLPatternOptions = webidl
},
]);
-export { URLPattern };
+export { URLPattern, urlPatternSettings };