Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend does not escape attributes #73

Open
rupanshusoi opened this issue Apr 26, 2021 · 3 comments
Open

Extend does not escape attributes #73

rupanshusoi opened this issue Apr 26, 2021 · 3 comments

Comments

@rupanshusoi
Copy link

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!

@awalterschulze
Copy link
Owner

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.

@rupanshusoi
Copy link
Author

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.

@awalterschulze
Copy link
Owner

Yes and adding this would break use cases for users who do not want escaping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants