Skip to content

Commit

Permalink
safest EOL detection
Browse files Browse the repository at this point in the history
  • Loading branch information
iamemilio committed Oct 20, 2022
1 parent 373f699 commit 5f6ebd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func getKey(p []byte, indx int) (string, int) {
}

func isEOL(p []byte, i int) bool {
return p[i] == '}' && i+1 < len(p) && p[i+1] == '\n'
return p[i] == '}' && i+2 == len(p)
}

func getStringValue(p []byte, indx int) (string, int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ func TestParseLogDataEscapes(t *testing.T) {
`{"level":"info","message":"escape quote,\",\" hi"}`,
},
{
"escape bracket,\"}\" hi",
"escape bracket,\"}\n hi",
"info",
`{"level":"info","message":"escape bracket,\"}\" hi"}`,
`{"level":"info","message":"escape bracket,\"}\n hi"}`,
},
}

Expand Down

0 comments on commit 5f6ebd8

Please sign in to comment.