From 11e5bb4305bac7a205e66f426013f3af65d8e2bf Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Wed, 12 Nov 2014 11:02:26 -0300 Subject: [PATCH] Escaping commas --- js/controllers/history.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/controllers/history.js b/js/controllers/history.js index 18c17359b..6f40c2b09 100644 --- a/js/controllers/history.js +++ b/js/controllers/history.js @@ -43,9 +43,11 @@ angular.module('copayApp.controllers').controller('HistoryController', return; } + var unit = w.settings.unitName; var data = res.items; var filename = "copay_history.csv"; - var csvContent = "data:text/csv;charset=utf-8,Date,Amount,Action,AddressTo,Comment\n"; + var csvContent = "data:text/csv;charset=utf-8,"; + csvContent += "Date,Amount(" + unit + "),Action,AddressTo,Comment\n"; data.forEach(function(it, index) { var dataString = formatDate(it.minedTs || it.sentTs) + ',' + it.amount + ',' + it.action + ',' + it.addressTo + ',' + formatString(it.comment); @@ -75,6 +77,9 @@ angular.module('copayApp.controllers').controller('HistoryController', function formatString(str) { if (!str) return ''; + //escaping commas + str = '\"' + str + '\"'; + return str; } });