Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug) Fix params quoting when using quotes on value #602

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions internal/dag/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,10 @@ func parseParams(

// stringifyParam converts a paramPair to a string representation.
func stringifyParam(param paramPair) string {
escapedValue := strings.ReplaceAll(param.value, `"`, `\"`)
quotedValue := fmt.Sprintf(`"%s"`, escapedValue)

if param.name != "" {
return fmt.Sprintf("%s=%s", param.name, quotedValue)
return fmt.Sprintf("%s=%s", param.name, param.value)
}
return quotedValue
return param.value
}

// processParams parses and processes the parameters for the DAG.
Expand Down
12 changes: 6 additions & 6 deletions internal/dag/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ func TestBuilder_BuildParams(t *testing.T) {
"Y": "foo",
"Z": "A B C",
"1": "first",
"2": `P1="foo"`,
"3": `P2="BAR"`,
"4": `P3="BAR"`,
"5": `X="bar"`,
"6": `Y="foo"`,
"7": `Z="A B C"`,
"2": `P1=foo`,
"3": `P2=BAR`,
"4": `P3=BAR`,
"5": `X=bar`,
"6": `Y=foo`,
"7": `Z=A B C`,
},
},
}
Expand Down
Loading