We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d39380 commit 862a7a6Copy full SHA for 862a7a6
test/fixtures/mock-routes.cjs
@@ -599,10 +599,10 @@ function matchRoute(url) {
599
* @returns {boolean}
600
*/
601
function urlMatchesPattern(url, pattern) {
602
- // Convert "https://example.com/**" to a prefix check
603
- if (pattern.endsWith('/**')) {
604
- const prefix = pattern.slice(0, -2)
605
- return url.startsWith(prefix)
+ // Support wildcard patterns (e.g. https://*-dsn.algolia.net/**)
+ if (pattern.includes('*')) {
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')
+ return new RegExp(`^${escaped}$`).test(url)
606
}
607
return url === pattern
608
0 commit comments