Check the blob size instead of the progress reports (#3249)
This commit is contained in:
committed by
GitHub
parent
9274ee72ad
commit
0df9487527
@@ -78,7 +78,6 @@ export const download = (
|
||||
toastCallback: () => void,
|
||||
) => {
|
||||
let basename = document.baseURI.replace(window.location.origin, "");
|
||||
let bytesLoaded = 0;
|
||||
const state = store.getState();
|
||||
const anonymousMode = state.system.anonymousMode;
|
||||
|
||||
@@ -107,7 +106,6 @@ export const download = (
|
||||
"progress",
|
||||
function (evt) {
|
||||
let percentComplete = Math.round((evt.loaded / fileSize) * 100);
|
||||
bytesLoaded = evt.loaded;
|
||||
if (progressCallback) {
|
||||
progressCallback(percentComplete);
|
||||
}
|
||||
@@ -118,7 +116,7 @@ export const download = (
|
||||
req.responseType = "blob";
|
||||
req.onreadystatechange = () => {
|
||||
if (req.readyState === XMLHttpRequest.DONE) {
|
||||
let completeDownload = bytesLoaded === fileSize;
|
||||
let completeDownload = req.response.size === fileSize;
|
||||
|
||||
if (req.status === StatusCodes.OK && completeDownload) {
|
||||
const rspHeader = req.getResponseHeader("Content-Disposition");
|
||||
|
||||
Reference in New Issue
Block a user