Skip to content

Commit

Permalink
Merge pull request #7679 from influxdata/jw-line-slash
Browse files Browse the repository at this point in the history
Fix string fields w/ trailing slashes
  • Loading branch information
jwilder authored Dec 5, 2016
2 parents 62af82f + 2f776ea commit 1677aff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ func scanFieldValue(buf []byte, i int) (int, []byte) {
start := i
quoted := false
for i < len(buf) {
// Only escape char for a field value is a double-quote
if buf[i] == '\\' && i+1 < len(buf) && buf[i+1] == '"' {
// Only escape char for a field value is a double-quote and backslash
if buf[i] == '\\' && i+1 < len(buf) && (buf[i+1] == '"' || buf[i+1] == '\\') {
i += 2
continue
}
Expand Down
15 changes: 15 additions & 0 deletions models/points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,21 @@ func TestParsePointWithStringWithCommas(t *testing.T) {
},
time.Unix(1, 0)),
)

// string w/ trailing escape chars
test(t, `cpu,host=serverA,region=us-east str="foo\\",str2="bar" 1000000000`,
NewTestPoint(
"cpu",
models.NewTags(map[string]string{
"host": "serverA",
"region": "us-east",
}),
models.Fields{
"str": "foo\\", // trailing escape char
"str2": "bar",
},
time.Unix(1, 0)),
)
}

func TestParsePointQuotedMeasurement(t *testing.T) {
Expand Down

0 comments on commit 1677aff

Please sign in to comment.