Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.2.0] Backport of Aborted uploads are not cleared properly #35134

Merged
merged 1 commit into from
May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ OC.Uploader.prototype = _.extend({
this.log('canceling uploads');
jQuery.each(this._uploads, function(i, upload) {
upload.abort();
upload.aborted = true;
});
this.clear();
},
Expand All @@ -691,7 +692,7 @@ OC.Uploader.prototype = _.extend({
clear: function() {
var remainingUploads = {};
_.each(this._uploads, function(upload, key) {
if (!upload.isDone) {
if (!upload.isDone && !upload.aborted) {
remainingUploads[key] = upload;
}
});
Expand Down
4 changes: 3 additions & 1 deletion apps/files/tests/js/fileUploadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ describe('OC.Upload tests', function() {
it('clear leaves pending uploads', function() {
uploader._uploads = {
'abc': {name: 'a job well done.txt', isDone: true},
'def': {name: 'whatevs.txt'}
'def': {name: 'whatevs.txt'},
'ghi': {name: 'aborted.txt', aborted: true}
};

uploader.clear();

//This does verify that aborted upload(s) will not be available in the _uploads
expect(uploader._uploads).toEqual({'def': {name: 'whatevs.txt'}});
});
});
Expand Down