diff --git a/app/vminsert/influx/parser.go b/app/vminsert/influx/parser.go index cb9a031b2..35fb32461 100644 --- a/app/vminsert/influx/parser.go +++ b/app/vminsert/influx/parser.go @@ -180,7 +180,7 @@ func (f *Field) unmarshal(s string, noEscapeChars, hasQuotedFields bool) error { func unmarshalRows(dst []Row, s string, tagsPool []Tag, fieldsPool []Field) ([]Row, []Tag, []Field, error) { noEscapeChars := strings.IndexByte(s, '\\') < 0 for len(s) > 0 { - n := nextUnquotedChar(s, '\n', noEscapeChars, true) + n := strings.IndexByte(s, '\n') if n == 0 { // Skip empty line s = s[1:] @@ -291,7 +291,7 @@ func unescapeTagValue(s string, noEscapeChars bool) string { return string(append(dst, '\\')) } ch := s[0] - if ch != ' ' && ch != ',' && ch != '=' && ch != '\\' && ch != '\n' { + if ch != ' ' && ch != ',' && ch != '=' && ch != '\\' { dst = append(dst, '\\') } dst = append(dst, ch) diff --git a/app/vminsert/influx/parser_test.go b/app/vminsert/influx/parser_test.go index 0cb914b1e..55429d13e 100644 --- a/app/vminsert/influx/parser_test.go +++ b/app/vminsert/influx/parser_test.go @@ -324,11 +324,11 @@ func TestRowsUnmarshalSuccess(t *testing.T) { }) // Escape chars - f(`fo\,bar\=baz,x\==\\a\,\=\q\ \\\a\=\,=4.34`, &Rows{ + f(`fo\,bar\=baz,x\=\b=\\a\,\=\q\ \\\a\=\,=4.34`, &Rows{ Rows: []Row{{ Measurement: `fo,bar=baz`, Tags: []Tag{{ - Key: `x=`, + Key: `x=\b`, Value: `\a,=\q `, }}, Fields: []Field{{ @@ -338,27 +338,6 @@ func TestRowsUnmarshalSuccess(t *testing.T) { }}, }) - // Escape newline - f("fo\\\nb\\,ar,x\\\ny=\\\n\\y a=\"foo\nbar\",b\\\nc\\==34\n", &Rows{ - Rows: []Row{{ - Measurement: "fo\nb,ar", - Tags: []Tag{{ - Key: "x\ny", - Value: "\n\\y", - }}, - Fields: []Field{ - { - Key: "a", - Value: 0, - }, - { - Key: "b\nc=", - Value: 34, - }, - }, - }}, - }) - // Multiple lines f("foo,tag=xyz field=1.23 48934\n"+ "bar x=-1i\n\n", &Rows{