1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

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 regex = new RegExp(
"^\\s*(" +
URL_OPEN_METHODS.join("|").split(".").join("\\.") +
URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") +
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
"i"
);