Use replaceAll in the recoverJsURL helper function

We can just do direct replacement when building the regular expression, rather than splitting the string into an Array and then re-joining it.
This commit is contained in:
Jonas Jenwald 2023-03-25 12:31:39 +01:00
parent c706c6c34f
commit 035a273d30

View File

@ -515,7 +515,7 @@ function recoverJsURL(str) {
const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"]; const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
const regex = new RegExp( const regex = new RegExp(
"^\\s*(" + "^\\s*(" +
URL_OPEN_METHODS.join("|").split(".").join("\\.") + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") +
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
"i" "i"
); );