MarkTraceur has submitted this change and it was merged.

Change subject: (bug 37302) wrong progress status of uploads.
......................................................................


(bug 37302) wrong progress status of uploads.

On debugging found that the fraction progress went sometimes > 1
This should partially fix the issue with wrong progress status.

Change-Id: Ib718e8d8b5232f67cd3106ac47e7576b88352f66
---
M resources/mw.FormDataTransport.js
1 file changed, 2 insertions(+), 3 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  J: Looks good to me, but someone else must approve



diff --git a/resources/mw.FormDataTransport.js 
b/resources/mw.FormDataTransport.js
index 499cb68..b6fdc39 100644
--- a/resources/mw.FormDataTransport.js
+++ b/resources/mw.FormDataTransport.js
@@ -30,8 +30,7 @@
 mw.FormDataTransport.prototype = {
     upload: function() {
         var _this = this,
-            file = this.uploadObject.file,
-            bytesAvailable = file.size;
+            file = this.uploadObject.file;
 
         // use timestamp + filename to avoid conflicts on server
         this.tempname = ( new Date() ).getTime().toString() + file.name;
@@ -56,7 +55,7 @@
                     return;
                 }
                 if (evt.lengthComputable) {
-                    var progress = parseFloat(evt.loaded) / bytesAvailable;
+                    var progress = parseFloat(evt.loaded / evt.total );
                     _this.progressCb(progress);
                 }
             }, false);

-- 
To view, visit https://gerrit.wikimedia.org/r/49269
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib718e8d8b5232f67cd3106ac47e7576b88352f66
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: J <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to