Skip to content

Commit

Permalink
Merge pull request #29283 from nextcloud/backport/28250/stable22
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Oct 19, 2021
2 parents 27c23b6 + 92c16b3 commit 086950f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,10 @@ OC.Uploader.prototype = _.extend({
// no list to check against
return true;
}
if (upload.getTargetFolder() !== fileList.getCurrentDirectory()) {
// not uploading to the current folder
return true;
}
var fileInfo = fileList.findFile(file.name);
if (fileInfo) {
conflicts.push([
Expand Down Expand Up @@ -997,7 +1001,8 @@ OC.Uploader.prototype = _.extend({
freeSpace = $('#free_space').val()
} else if (upload.getTargetFolder().indexOf(self.fileList.getCurrentDirectory()) === 0) {
// Check subdirectory free space if file is uploaded there
var targetSubdir = upload._targetFolder.replace(self.fileList.getCurrentDirectory(), '')
// Retrieve the folder destination name
var targetSubdir = upload._targetFolder.split('/').pop()
freeSpace = parseInt(upload.uploader.fileList.getModelForFile(targetSubdir).get('quotaAvailableBytes'))
}
if (freeSpace >= 0 && selection.totalBytes > freeSpace) {
Expand Down
1 change: 1 addition & 0 deletions apps/files/tests/js/fileUploadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('OC.Upload tests', function() {
files: [file],
jqXHR: jqXHR,
response: sinon.stub().returns(jqXHR),
targetDir: "/",
submit: sinon.stub(),
abort: sinon.stub()
};
Expand Down

0 comments on commit 086950f

Please sign in to comment.