mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 07:12:20 +00:00
fix(context): skip over empty keys to avoid replacing $ and breaking other values
This commit is contained in:
1 file changed
+4
@@ -201,6 +201,10 @@ impl SproutContext {
|
|||||||
let mut result = text.as_ref().to_string();
|
let mut result = text.as_ref().to_string();
|
||||||
let mut did_change = false;
|
let mut did_change = false;
|
||||||
for (key, value) in values {
|
for (key, value) in values {
|
||||||
|
// Empty keys are not supported.
|
||||||
|
if key.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let next_result = result.replace(&format!("${key}"), value);
|
let next_result = result.replace(&format!("${key}"), value);
|
||||||
if result != next_result {
|
if result != next_result {
|
||||||
did_change = true;
|
did_change = true;
|
||||||
|
|||||||
Reference in new issue
Block a user