]> source.dussan.org Git - nextcloud-server.git/commitdiff
Some more hardening 3896/head
authorJoas Schilling <coding@schilljs.com>
Fri, 17 Mar 2017 11:59:33 +0000 (12:59 +0100)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 4 Apr 2017 06:51:21 +0000 (08:51 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files/js/file-upload.js [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index c7e2329..bfb88bc
@@ -1006,14 +1006,15 @@ OC.Uploader.prototype = _.extend({
                                                bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds;
                                                buffer[bufferIndex] = remainingSeconds; //buffer to make it smoother
                                                bufferIndex = (bufferIndex + 1) % bufferSize;
-                                               bufferIndex2 = bufferIndex2++;
+                                               bufferIndex2++;
                                        }
                                        var smoothRemainingSeconds;
-                                       if(bufferIndex2<20) {
-                                                       smoothRemainingSeconds = bufferTotal / bufferIndex2;
-                                       }
-                                       else {
-                                                smoothRemainingSeconds = bufferTotal / bufferSize; 
+                                       if (bufferIndex2 > 0 && bufferIndex2 < 20) {
+                                               smoothRemainingSeconds = bufferTotal / bufferIndex2;
+                                       } else if (bufferSize > 0) {
+                                               smoothRemainingSeconds = bufferTotal / bufferSize;
+                                       } else {
+                                               smoothRemainingSeconds = 1;
                                        }
 
                                        var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();