Browse Source

Merge pull request #2738 from Budibase/fix-regex-binding-replacement

Fix regex binding replacement issue due to not being escaped
master
Andrew Kingston 5 years ago
committed by GitHub
parent
commit
3764fdb1e9
  1. 7
      packages/builder/src/builderStore/dataBinding.js

7
packages/builder/src/builderStore/dataBinding.js

@ -443,10 +443,9 @@ function bindingReplacement(bindableProperties, textWithBindings, convertTo) {
for (let from of convertFromProps) { for (let from of convertFromProps) {
if (shouldReplaceBinding(newBoundValue, from, convertTo)) { if (shouldReplaceBinding(newBoundValue, from, convertTo)) {
const binding = bindableProperties.find(el => el[convertFrom] === from) const binding = bindableProperties.find(el => el[convertFrom] === from)
newBoundValue = newBoundValue.replace( while (newBoundValue.includes(from)) {
new RegExp(from, "gi"), newBoundValue = newBoundValue.replace(from, binding[convertTo])
binding[convertTo] }
)
} }
} }
result = result.replace(boundValue, newBoundValue) result = result.replace(boundValue, newBoundValue)

Loading…
Cancel
Save