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

Lexer allows T-prefix on local dates #442

Closed
moorereason opened this issue Sep 12, 2020 · 1 comment · Fixed by #446
Closed

Lexer allows T-prefix on local dates #442

moorereason opened this issue Sep 12, 2020 · 1 comment · Fixed by #446
Labels
bug Issues describing a bug in go-toml.

Comments

@moorereason
Copy link
Contributor

Describe the Bug

The existing dateRegexp allows a T-prefix on a local date.

To Reproduce

This should not pass, but it does:

diff --git a/lexer_test.go b/lexer_test.go
index 225a52a..af12e9f 100644
--- a/lexer_test.go
+++ b/lexer_test.go
@@ -350,6 +350,12 @@ func TestKeyEqualDate(t *testing.T) {
                {Position{1, 7}, tokenDate, "1979-05-27 07:32:00Z"},
                {Position{1, 27}, tokenEOF, ""},
        })
+       testFlow(t, "foo = T07:32:00", []token{
+               {Position{1, 1}, tokenKey, "foo"},
+               {Position{1, 5}, tokenEqual, "="},
+               {Position{1, 7}, tokenLocalDate, "T07:32:00"},
+               {Position{1, 16}, tokenEOF, ""},
+       })
 }

 func TestFloatEndingWithDot(t *testing.T) {

Versions

  • go-toml: 5c94d86
  • go version go1.15.2 linux/amd64
@pelletier pelletier added the bug Issues describing a bug in go-toml. label Sep 12, 2020
@pelletier
Copy link
Owner

Thank you! Definitely not conforming to the spec.

AllenX2018 added a commit to AllenX2018/go-toml that referenced this issue Oct 9, 2020
The dateRegex matched localDate with T, we should remove it.

Fix pelletier#442
pelletier pushed a commit that referenced this issue Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants