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

isNumber accepts non-numbers #13

Open
drt24 opened this issue Jul 13, 2016 · 2 comments
Open

isNumber accepts non-numbers #13

drt24 opened this issue Jul 13, 2016 · 2 comments

Comments

@drt24
Copy link

drt24 commented Jul 13, 2016

isNumber in escape.go is supposed to return true if it is passed a string that represents a number. However, it accepts "127.0.0.1" as a number but dot does not accept that. More generally it allows an arbitrary number of "."s in a number. This causes strings to not be escaped when they should be.

@drt24
Copy link
Author

drt24 commented Jul 13, 2016

Possibly the best solution would be to just use the regexp from the dot specification: [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? ) ? The regexp package is standard and with MustCompile the regexp would only need to be compiled once as the resulting Regexp is thread safe. https://golang.org/pkg/regexp/#Regexp

@awalterschulze
Copy link
Owner

Sounds like a good fix, would you want to make a pull request, or can I make the fix?
If you make a pull request, are you ok with giving over your copyright?

drt24 added a commit to drt24/gographviz that referenced this issue Jul 13, 2016
drt24 added a commit to drt24/gographviz that referenced this issue Jul 13, 2016
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

Successfully merging a pull request may close this issue.

2 participants