瀏覽代碼

hot fix for crazy totalProgress

//cc @goto-bus-stop
Artur Paikin 6 年之前
父節點
當前提交
4938e21c76
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      packages/@uppy/core/src/index.js

+ 7 - 1
packages/@uppy/core/src/index.js

@@ -699,10 +699,16 @@ class Uppy {
       uploadedSize += averageSize * (file.progress.percentage || 0)
     })
 
-    const totalProgress = totalSize === 0
+    let totalProgress = totalSize === 0
       ? 0
       : Math.round(uploadedSize / totalSize * 100)
 
+    // hot fix, because:
+    // uploadedSize ended up larger than totalSize, resulting in 1325% total
+    if (totalProgress > 100) {
+      totalProgress = 100
+    }
+
     this.setState({ totalProgress })
     this.emit('progress', totalProgress)
   }