Skip to content

struct: escape delimiter in string slices on ReflectFrom - #402

Open
team-humaki wants to merge 1 commit into
go-ini:mainfrom
team-humaki:quote-comma-slices
Open

team-humaki wants to merge 1 commit into
go-ini:mainfrom
team-humaki:quote-comma-slices

Conversation

@team-humaki

Copy link
Copy Markdown

ReflectFrom joined []string with the field delimiter and did not escape delimiter characters inside an element. Values like Test with comma, Three were then split on load.

Escape \ then the delimiter when writing string slices, using the same rules Key.Strings already applies on read (value1\, value2 in testdata). Round-trip of a slice that contains the delimiter now preserves elements.

Fixes #348

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using []string in a struct goes wrong if any of the strings contains a comma ','

1 participant