소스 검색

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)
   }