Browse Source
Merge pull request #2738 from Budibase/fix-regex-binding-replacement
Fix regex binding replacement issue due to not being escaped
pull/2757/head
Andrew Kingston
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
4 deletions
-
packages/builder/src/builderStore/dataBinding.js
|
|
|
@ -443,10 +443,9 @@ function bindingReplacement(bindableProperties, textWithBindings, convertTo) { |
|
|
|
for (let from of convertFromProps) { |
|
|
|
if (shouldReplaceBinding(newBoundValue, from, convertTo)) { |
|
|
|
const binding = bindableProperties.find(el => el[convertFrom] === from) |
|
|
|
newBoundValue = newBoundValue.replace( |
|
|
|
new RegExp(from, "gi"), |
|
|
|
binding[convertTo] |
|
|
|
) |
|
|
|
while (newBoundValue.includes(from)) { |
|
|
|
newBoundValue = newBoundValue.replace(from, binding[convertTo]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
result = result.replace(boundValue, newBoundValue) |
|
|
|
|