Fix newline escaping in line protocol (#3992)

This commit is contained in:
Daniel Nelson
2018-04-09 15:29:52 -07:00
committed by GitHub
parent d9230ac92d
commit cad0cf4c78
5 changed files with 5302 additions and 5084 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -142,7 +142,7 @@ fieldfloat =
fieldinteger =
(integer 'i') >begin %integer;
fieldunsigned =
fieldunsigned =
(unsigned 'u') >begin %unsigned;
false =
@@ -155,7 +155,7 @@ fieldbool =
(true | false) >begin %bool;
fieldstringchar =
[^\\"] | '\\' [\\"];
[^\n\f\r\\"] | '\\' [\\"];
fieldstring =
fieldstringchar* >begin %string;

View File

@@ -1154,6 +1154,22 @@ var tests = []struct {
},
},
},
{
name: "invalid newline in string field",
input: []byte("cpu value=\"4\n2\""),
results: []Result{
Result{
Name: Measurement,
Value: []byte("cpu"),
},
Result{
err: ErrFieldParse,
},
Result{
err: ErrFieldParse,
},
},
},
{
name: "invalid field value",
input: []byte(`cpu value=howdy`),