Fix chat exporting when someone has used unicode

Only affects clients still using 512
This commit is contained in:
Arokha Sieyes
2020-03-14 23:51:08 -04:00
parent 921079908d
commit f9b732f94a

View File

@@ -641,9 +641,6 @@ function start_vue() {
textToSave += "<br>\n";
});
textToSave += "</body></html>";
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
var fileprefix = "log";
var extension =".html";
@@ -671,14 +668,17 @@ function start_vue() {
var filename = fileprefix+datesegment+extension;
//Unlikely to work unfortunately, not supported in any version of IE, only Edge
var hiddenElement = document.createElement('a');
if (hiddenElement.download !== undefined) {
hiddenElement.download = filename;
hiddenElement.click();
//Probably what will end up getting used
} else {
let blob = new Blob([textToSave], {type: 'text/html;charset=utf8;'});
saved = window.navigator.msSaveOrOpenBlob(blob, filename);
}
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave); //Has a problem in byond 512 due to weird unicode handling
hiddenElement.target = '_blank';
hiddenElement.download = filename;
hiddenElement.click();
//Probably what will end up getting used
} else {
var blob = new Blob([textToSave], {type: 'text/html;charset=utf8;'});
saved = window.navigator.msSaveOrOpenBlob(blob, filename);
}
},
do_latency_test: function() {
send_latency_check();