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 f4bb557 commit 0723a87Copy full SHA for 0723a87
src/lib/fetch-delay.js
@@ -34,7 +34,9 @@ function matchGlob(pattern, string) {
34
if (!pattern.includes("*")) {
35
return pattern === string;
36
}
37
- return new RegExp(`^${pattern.replace(/\*/g, ".*")}$`).test(string);
+ // compile a glob pattern to a regular expression, also escape special characters
38
+ const rx = new RegExp(`^${pattern.replace(/[-/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*")}$`);
39
+ return rx.test(string);
40
41
42
export async function fetchDelay(url, cb) {
0 commit comments