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

Fix for double quotes appearing in csv log #229

Merged
merged 2 commits into from
Dec 2, 2023
Merged

Conversation

imadityaa
Copy link
Contributor

Virtual Client logs the produced metrics locally in csv format. If any of the fields appearing in the csv has quotes ("), it can potentially break the csv.
As a standard way of handling writing to csv, double quote appearing in the field should be escaped by preceding it with another double quote.
Reference: https://stackoverflow.com/questions/17808511/how-to-properly-escape-a-double-quote-in-csv

Modifying one the existing Unit Tests as well to have this unit tested.

@imadityaa imadityaa requested a review from yangpanMS December 1, 2023 11:43
Copy link
Contributor

@yangpanMS yangpanMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but is there any other char that we need to escape?

@imadityaa
Copy link
Contributor Author

Approved, but is there any other char that we need to escape?

As per online documents, it should be sufficient to escape the double quotes and enclose the full content within double quotes, which we are doing in VC now.

@imadityaa imadityaa merged commit 0c32303 into main Dec 2, 2023
@imadityaa imadityaa deleted the users/adityaa/csvFix branch December 2, 2023 03:08
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.

2 participants