mirror of
https://github.com/mikefarah/yq.git
synced 2025-03-15 00:15:36 +00:00
Fixed CSV line break issue #1974
This commit is contained in:
parent
29056ee87f
commit
9e9cb65ec0
@ -172,6 +172,13 @@ var csvScenarios = []formatScenario{
|
|||||||
expected: expectedYamlFromCSVWithObject,
|
expected: expectedYamlFromCSVWithObject,
|
||||||
scenarioType: "decode-csv",
|
scenarioType: "decode-csv",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: "Decode CSV line breaks",
|
||||||
|
skipDoc: true,
|
||||||
|
input: "heading1\n\"some data\nwith a line break\"\n",
|
||||||
|
expected: "- heading1: |-\n some data\n with a line break\n",
|
||||||
|
scenarioType: "decode-csv",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "Parse CSV into an array of objects, no auto-parsing",
|
description: "Parse CSV into an array of objects, no auto-parsing",
|
||||||
subdescription: "First row is assumed to be the header row. Entries with YAML/JSON will be left as strings.",
|
subdescription: "First row is assumed to be the header row. Entries with YAML/JSON will be left as strings.",
|
||||||
|
@ -95,6 +95,11 @@ func parseSnippet(value string) (*CandidateNode, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if result.Tag == "!!str" {
|
||||||
|
// use the original string value, as
|
||||||
|
// decoding drops new lines
|
||||||
|
return createScalarNode(value, value), nil
|
||||||
|
}
|
||||||
result.Line = 0
|
result.Line = 0
|
||||||
result.Column = 0
|
result.Column = 0
|
||||||
return result, err
|
return result, err
|
||||||
|
Loading…
Reference in New Issue
Block a user