aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-12-23 18:53:01 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-12-23 18:53:01 +0100
commitfc2069c1dd44698cfeba48b18139041a2fb6a1d5 (patch)
tree3ea3c87aae5e025ce3572e559a920a4b66345697 /apps/files/js/file-upload.js
parent5b61120491f57485579954f3f2f973ca5e6b483f (diff)
downloadnextcloud-server-fc2069c1dd44698cfeba48b18139041a2fb6a1d5.tar.gz
nextcloud-server-fc2069c1dd44698cfeba48b18139041a2fb6a1d5.zip
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 7c4c5fe6ae91 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>
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 3c0ca319225..178cda856a6 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -586,7 +586,10 @@ OC.Uploader.prototype = _.extend({
_.each(uploads, function(upload) {
self._uploads[upload.data.uploadId] = upload;
});
- self.totalToUpload = _.reduce(uploads, function(memo, upload) { return memo+upload.getFile().size; }, 0);
+ if (!self._uploading) {
+ self.totalToUpload = 0;
+ }
+ self.totalToUpload += _.reduce(uploads, function(memo, upload) { return memo+upload.getFile().size; }, 0);
var semaphore = new OCA.Files.Semaphore(5);
var promises = _.map(uploads, function(upload) {
return semaphore.acquire().then(function(){