mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 17:10:17 +00:00
fix(context): skip over empty keys to avoid replacing $ and breaking other values
This commit is contained in:
@@ -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