Skip to content

Commit acdf895

Browse files
danxuliubackportbot[bot]
authored andcommitted
Fix total upload size overwritten by next upload
The upload progress is based on the "totalToUpload" variable. However, as the variable is set when an upload is submitted, if another upload is submitted before the previous one finished the upload progress only took into account the size of the new upload (although the upload itself worked fine; the files of the new submitted upload are added to the active one). Now "totalToUpload" is either increased or set depending on whether an upload is active or not. Note that although "data.total" holds the total size of the files being uploaded "totalToUpload" needs to be used in "fileuploadprogressall" instead; "totalToUpload" is calculated when the upload is submitted, but since 7c4c5fe the actual upload of the files, and thus updating the value of "data.total", may be deferred until the parent folders were created. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent 6a85c12 commit acdf895

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/files/js/file-upload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,10 @@ OC.Uploader.prototype = _.extend({
586586
_.each(uploads, function(upload) {
587587
self._uploads[upload.data.uploadId] = upload;
588588
});
589-
self.totalToUpload = _.reduce(uploads, function(memo, upload) { return memo+upload.getFile().size; }, 0);
589+
if (!self._uploading) {
590+
self.totalToUpload = 0;
591+
}
592+
self.totalToUpload += _.reduce(uploads, function(memo, upload) { return memo+upload.getFile().size; }, 0);
590593
var semaphore = new OCA.Files.Semaphore(5);
591594
var promises = _.map(uploads, function(upload) {
592595
return semaphore.acquire().then(function(){

0 commit comments

Comments
 (0)