fix(triggers): don't false-flag Children/Parent attribute refs in expression validation
This commit is contained in:
@@ -428,6 +428,18 @@ public class ValidationService
|
||||
|
||||
while ((index = expression.IndexOf(marker, index, StringComparison.Ordinal)) >= 0)
|
||||
{
|
||||
// Only treat this as a self-attribute reference when it is not a member
|
||||
// access. A bare `Attributes["X"]` resolves against the flattened
|
||||
// configuration; `Children["Pump"].Attributes["X"]` and
|
||||
// `Parent.Attributes["X"]` are member accesses (preceded by '.') whose
|
||||
// dotted/composed canonical names cannot be checked against the flat
|
||||
// self-attribute set — skip them rather than emit a false positive.
|
||||
if (index > 0 && expression[index - 1] == '.')
|
||||
{
|
||||
index += marker.Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
var cursor = index + marker.Length;
|
||||
// Skip whitespace between '[' and the literal.
|
||||
while (cursor < expression.Length && char.IsWhiteSpace(expression[cursor]))
|
||||
|
||||
Reference in New Issue
Block a user