Sanitize values for CSV. #7697

Merged
Ruk33 merged 2 commits from 7692-transaction-export-creates-invalid-csv-file into master 2022-10-17 17:07:33 +02:00
Ruk33 commented 2022-10-10 22:29:17 +02:00 (Migrated from github.com)

Fixes

Issue Number: https://github.com/lbryio/lbry-desktop/issues/7692

What is the current behavior?

When exporting to CSV, no sanitization is being performed, thus,
the export may be incorrect if any of the values use a comma
or ".

What is the new behavior?

All values are enclosed in " and extra " are escaped.

Other information

PR Checklist

Toggle...

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes)
  • Documentation changes
  • Other - Please describe:

Please check all that apply to this PR using "x":

  • I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
  • I added a line describing my change to CHANGELOG.md
  • I have checked that this PR does not introduce a breaking change
  • This PR introduces breaking changes and I have provided a detailed explanation below
## Fixes Issue Number: https://github.com/lbryio/lbry-desktop/issues/7692 <!-- Tip: - Add keywords to directly close the Issue when the PR is merged. - Skip the keyword if the Issue contains multiple items. - https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword --> ## What is the current behavior? When exporting to CSV, no sanitization is being performed, thus, the export may be incorrect if any of the values use a comma or `"`. ## What is the new behavior? All values are enclosed in `"` and extra `"` are escaped. ## Other information <!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. --> ## PR Checklist <!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" --> <details><summary>Toggle...</summary> What kind of change does this PR introduce? - [x] Bugfix - [ ] Feature - [ ] Code style update (formatting) - [ ] Refactoring (no functional changes) - [ ] Documentation changes - [ ] Other - Please describe: Please check all that apply to this PR using "x": - [x] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged) - [ ] I added a line describing my change to CHANGELOG.md - [x] I have checked that this PR does not introduce a breaking change - [ ] This PR introduces breaking changes and I have provided a detailed explanation below </details>
jessopb (Migrated from github.com) reviewed 2022-10-13 21:00:39 +02:00
jessopb (Migrated from github.com) left a comment

Question..

Question..
jessopb (Migrated from github.com) commented 2022-10-13 21:00:23 +02:00

Everything I read about escaping " with csv says to do "" . What's the reasoning for \" ? Is that widely supported in inputs?

Everything I read about escaping " with csv says to do "" . What's the reasoning for \\" ? Is that widely supported in inputs?
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-desktop#7697
No description provided.