Refactor exportToCSV js function

This commit is contained in:
Dan Sosedoff 2014-10-29 18:35:13 -05:00
parent 981d332610
commit 392cab1b1c

View File

@ -237,15 +237,13 @@ function exportToCSV() {
return;
}
// Replace line breaks with spaces
query = query.replace(/\n/g, " ");
setCurrentTab("table_query");
query = window.encodeURI(query)
// Replace line breaks with spaces and properly encode query
query = window.encodeURI(query.replace(/\n/g, " "));
var url = "http://" + window.location.host + "/query?format=csv&query=" + query;
var win = window.open(url, '_blank');
setCurrentTab("table_query");
win.focus();
}