Skip to content

Commit

Permalink
Escape all memos in CSV export
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Aug 30, 2020
1 parent 8821d9e commit 719e2ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ class Sidebar extends PureComponent<Props, State> {
if (t.detailedTxns) {
return t.detailedTxns.map(dt => {
const normaldate = dateformat(t.time * 1000, 'mmm dd yyyy hh::MM tt');
const escapedMemo = dt.memo ? dt.memo.replace(/"/g, '""') : '';

// Add a single quote "'" into the memo field to force interpretation as a string, rather than as a
// formula from a rogue memo
const escapedMemo = dt.memo ? `'${dt.memo.replace(/"/g, '""')}'` : '';

return `${t.time},"${normaldate}","${t.txid}","${t.type}",${dt.amount},"${dt.address}","${escapedMemo}"`;
});
Expand Down

0 comments on commit 719e2ac

Please sign in to comment.