Skip to content
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
3 changes: 3 additions & 0 deletions internal/command/secrets/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func parseSecrets(reader io.Reader) (map[string]string, error) {
if strings.HasPrefix(value, `"`) && strings.HasSuffix(value, `"`) {
// Remove double quotes
value = value[1 : len(value)-1]
} else if strings.HasPrefix(value, `'`) && strings.HasSuffix(value, `'`) {
// Remove single quotes
value = value[1 : len(value)-1]
}
secrets[key] = value
}
Expand Down
10 changes: 10 additions & 0 deletions internal/command/secrets/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ func Test_parse_with_comment(t *testing.T) {
}, secrets)
}

func Test_parse_with_single_quotes(t *testing.T) {
reader := strings.NewReader("FOO='BAR BAZ'\nKEY='value'")
secrets, err := parseSecrets(reader)
assert.NoError(t, err)
assert.Equal(t, map[string]string{
"FOO": "BAR BAZ",
"KEY": "value",
}, secrets)
}

// Test single-line triple-quoted strings
func Test_parse_singleline_triple_quotes(t *testing.T) {
reader := strings.NewReader(`VARIABLE="""my-single-line-multiline-string"""
Expand Down
Loading