fix: decodeURI() failing on malformated URI + chore(deps): bump

This commit is contained in:
Liyas Thomas
2020-12-29 07:13:46 +05:30
parent 353978f115
commit 9ac0cf1406
5 changed files with 18 additions and 18 deletions

View File

@@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) {
return string
}
const searchTerm = /<<([^>]*)>>/g // "<<myVariable>>"
return decodeURI(string).replace(searchTerm, (match, p1) => variables[p1] || "")
return decodeURI(encodeURI(string)).replace(searchTerm, (match, p1) => variables[p1] || "")
}