Some more hardening

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-03-17 12:59:33 +01:00 committed by Roeland Jago Douma
parent 62fb3bb3ef
commit b6c1f3fc6d
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 7 additions and 6 deletions

13
apps/files/js/file-upload.js Executable file → Normal file
View File

@ -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();