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

Add CSV lazyQuotes option to transform.Unmarshal #11884

Closed
Menrath opened this issue Jan 13, 2024 · 4 comments · Fixed by #11885
Closed

Add CSV lazyQuotes option to transform.Unmarshal #11884

Menrath opened this issue Jan 13, 2024 · 4 comments · Fixed by #11885

Comments

@Menrath
Copy link

Menrath commented Jan 13, 2024

Sometimes we deal with CSV files that use lazy quotes. The Go library used already supports a setting to support this but within the hugo getCsv function we have no way to pass this as a parameter.

Example/Background

@jmooring
Copy link
Member

Adding this option to data.GetCSV would be messy, and at some point we should deprecate both data.GetCSV and data.GetJSON in favor of transform.Unmarshal.

Adding this option to transform.Unmarshal makes sense to me.

@Menrath
Copy link
Author

Menrath commented Jan 13, 2024

Yes I tried to add it and make a Pull Request and stopped because it was messy and I am absolutely no golang expert.

@jmooring
Copy link
Member

jmooring commented Jan 13, 2024

Rethinking this, does it even need to be configurable? The current behavior is to throw an error. I can't think of any downside to enabling LazyQuotes when using data.GetCSV or transform.Unmarshal.

Edit...

Rethinking this again, if it isn't broken don't fix it. We should add this as option to transform.Unmarshal (default to false) and leave data.GetCSV as is.

@gohugoio gohugoio deleted a comment from XoL1507 Jan 13, 2024
@jmooring jmooring changed the title Be able to pass lazyQuotes option to the Go csv.NewReader Add CSV lazyDecoding option to transform.Unmarshal Jan 13, 2024
jmooring added a commit to jmooring/hugo that referenced this issue Jan 13, 2024
If true, a quote may appear in an unquoted field and a non-doubled quote
may appear in a quoted field. It defaults to false.

Closes gohugoio#11884
@jmooring jmooring changed the title Add CSV lazyDecoding option to transform.Unmarshal Add CSV lazyQuotes option to transform.Unmarshal Jan 13, 2024
jmooring added a commit to jmooring/hugo that referenced this issue Jan 13, 2024
If true, a quote may appear in an unquoted field and a non-doubled quote
may appear in a quoted field. It defaults to false.

Closes gohugoio#11884
bep pushed a commit that referenced this issue Jan 16, 2024
If true, a quote may appear in an unquoted field and a non-doubled quote
may appear in a quoted field. It defaults to false.

Closes #11884
Copy link

github-actions bot commented Feb 7, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants