summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-17 12:59:33 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-04 08:51:21 +0200
commitb6c1f3fc6d36dbff40ce7791297765193cbd128c (patch)
tree0ab1b7a92fbaab9c978465347e7599a087d8bf09 /apps/files
parent62fb3bb3ef5f85317dcd6e06f55ef36e3a929640 (diff)
downloadnextcloud-server-b6c1f3fc6d36dbff40ce7791297765193cbd128c.tar.gz
nextcloud-server-b6c1f3fc6d36dbff40ce7791297765193cbd128c.zip
Some more hardening
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files')
-rw-r--r--[-rwxr-xr-x]apps/files/js/file-upload.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index c7e2329eabc..bfb88bc5d20 100755..100644
--- 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();