Skip to content

Commit 2de49f4

Browse files
committed
minor
1 parent 8af5ed0 commit 2de49f4

File tree

1 file changed

+10
-9
lines changed
  • services/static-webserver/client/source/class/osparc/utils

1 file changed

+10
-9
lines changed

services/static-webserver/client/source/class/osparc/utils/Utils.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -850,24 +850,25 @@ qx.Class.define("osparc.utils.Utils", {
850850
}
851851
});
852852
xhr.addEventListener("progress", e => {
853-
if (xhr.readyState === XMLHttpRequest.LOADING) {
854-
if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 400)) {
855-
if (e["type"] === "progress" && progressCb) {
856-
progressCb(e.loaded / e.total);
857-
}
858-
}
853+
if (
854+
progressCb &&
855+
xhr.readyState === XMLHttpRequest.LOADING &&
856+
(xhr.status === 0 || (xhr.status >= 200 && xhr.status < 400)) &&
857+
e["type"] === "progress"
858+
) {
859+
progressCb(e.loaded / e.total);
859860
}
860861
});
861862
xhr.addEventListener("load", () => {
862863
if (xhr.status == 200) {
863-
if (loadedCb) {
864-
loadedCb();
865-
}
866864
const blob = new Blob([xhr.response]);
867865
if (!fileName) {
868866
fileName = this.self().filenameFromContentDisposition(xhr);
869867
}
870868
this.self().downloadBlobContent(blob, fileName);
869+
if (loadedCb) {
870+
loadedCb();
871+
}
871872
resolve();
872873
} else {
873874
reject(xhr);

0 commit comments

Comments
 (0)