Extend does not escape attributes
rupanshusoi opened this issue · comments
I am using the following to update node labels in an Escape
graph.Nodes.Lookup[id].Attrs.Extend(attrs)
but the new label is not automatically escaped. Maybe there is a better way to update node attributes that I'm missing.
On the other hand, if this is a bug, I'd happy to try to fix it. At a first glance at the implementation, it does not look like the escaping logic is executed for any Attrs
method.
Thanks!
We have a special Escape
graph that escapes things
https://github.com/awalterschulze/gographviz/blob/master/escape.go
But we do not escape by default
Maybe there is space to "extend" the Escape
graph somehow with Extend
or create an EscapeAttrs
type, but I don't know what would be the best solution.
Yes, I did indeed use an Escape
graph (and saw the same problem).
I noticed that changing this line to
attrs.add(key, esc(value))
fixes the problem. However, we would only want to call esc
if the underlying graph was an Escape
, and I don't see a way in the current API to check that.
Yes and adding this would break use cases for users who do not want escaping.