From b6c1f3fc6d36dbff40ce7791297765193cbd128c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 17 Mar 2017 12:59:33 +0100 Subject: [PATCH] Some more hardening Signed-off-by: Joas Schilling --- apps/files/js/file-upload.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) mode change 100755 => 100644 apps/files/js/file-upload.js diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js old mode 100755 new mode 100644 index c7e2329eab..bfb88bc5d2 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -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();