Open sreeraj-rajendran opened 5 years ago
Do you get any file downloaded at all ? Can you poosible share it (by emailing it to extension-support@mskold.com) ?
Does the tester name contains any "special" characters ?
Thanks @mattias-skold for checking on this. No, the file doesn't get downloaded at all. It immediately fails with a "Network error" message.
There are no special characters in the Tester Name. I am able to export another suite successfully, by filtering with the same Tester.
Could you:
Thanks @mattias-skold. I would probably need to get approvals before sharing that data, I will update you on that. Is there anything that I could do / look with the data from the console to find any possible issues?
Thanks again for the help!
@mattias-skold , I was checking the solution for this post: https://stackoverflow.com/questions/39374157/angular-save-file-as-csv-result-in-failed-network-error-only-on-chrome
I then tried forcing the download to use a blob, and then the download works fine, and I am able to open the file as well, fine.
I have indicated the code changes with comments below:
function SaveFile(data, fileName, type) {
if (window.navigator.msSaveOrOpenBlob != null) {
SaveFileMsBlob(str2bytes(data), fileName, type);
}
else {
// old - SaveFileDataUri(btoa(data), fileName, type);
SaveFileDataUri(str2bytes(data), fileName, type);
}
}
exports.SaveFile = SaveFile;
function SaveFileDataUri(data, fileName, type) {
var blob = new Blob([data], {type: 'application/vnd.ms-excel'}); //added
var a = document.body.appendChild(document.createElement("a"));
a["download"] = fileName;
//old - a.href = "data:text/" + type + ";base64," + data;
a.href = window.URL.createObjectURL(blob); //added
a.innerHTML = "download";
a.target = "_blank";
a.click();
document.body.removeChild(a);
}
Can you please let me know if this could have been an issue with handling the save operation and whether the modifications look good?
Thanks!
@mattias-skold can you please let me know if you had a chance to check the details shared in the previous post -- thank you very much for the help!
@sreeraj-rajendran I'm not sure what you want me to check ? Overall I think it looks good, but I havent got into details on browser compat issues.
If it works for you - use it. If you submit a PR Ill investigate the browser compat and test it on different browsers and version before accepting the PR.
Thanks @mattias-skold . I will try and submit a PR.
We have an issue while trying to export the data for a specific Tester from a Suite. The export always fails with the message - "Failed-Network error" - this happens in Chrome, but the download also fails in IE and Edge,
The export works fine for other combinations.
Also tried from different network and machines to eliminate network / AV issues. The browser developer traces and fiddler shows no errors.
I am not a developer, please excuse any mistakes in my queries: I was able to verify that the code works fine until the below function, and fails on a.click().
The "data" shows as 4.2 MB.
I am not sure if it is happening because of the direct data transfer. window.navigator.msSaveOrOpenBlob stays null in the below function, and it chooses to go via SaveFileDataUri(btoa(data), fileName, type);
function SaveFile(data, fileName, type) { if (window.navigator.msSaveOrOpenBlob != null) { SaveFileMsBlob(str2bytes(data), fileName, type); } else { SaveFileDataUri(btoa(data), fileName, type); } }
Will there be any issues with the SaveFileDataUri method with data sizes around 4.2 MB?
Thanks for the help.