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; return;
} }
// Replace line breaks with spaces // Replace line breaks with spaces and properly encode query
query = query.replace(/\n/g, " "); query = window.encodeURI(query.replace(/\n/g, " "));
setCurrentTab("table_query");
query = window.encodeURI(query)
var url = "http://" + window.location.host + "/query?format=csv&query=" + query; var url = "http://" + window.location.host + "/query?format=csv&query=" + query;
var win = window.open(url, '_blank'); var win = window.open(url, '_blank');
setCurrentTab("table_query");
win.focus(); win.focus();
} }