Fix newline escaping in line protocol (#3992)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -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`),
|
||||
|
||||
Reference in New Issue
Block a user