summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-10-19 11:08:21 +0200
committerGitHub <noreply@github.com>2021-10-19 11:08:21 +0200
commit9edb59ec57f8ea6ec2d080032712f1a8bcd68b55 (patch)
treea0198f223ad60f1f055d7c54b0e0b80981d00ecf /apps
parent903afc13111794ec2748a5290b22038825bbdc1f (diff)
parent3ae52133083c5d498bf9ae4f7bab05f26ad25330 (diff)
downloadnextcloud-server-9edb59ec57f8ea6ec2d080032712f1a8bcd68b55.tar.gz
nextcloud-server-9edb59ec57f8ea6ec2d080032712f1a8bcd68b55.zip
Merge pull request #29282 from nextcloud/backport/28250/stable21
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/file-upload.js7
-rw-r--r--apps/files/tests/js/fileUploadSpec.js1
2 files changed, 7 insertions, 1 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index ec017ceb08e..672fc1d770b 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -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([
@@ -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) {
diff --git a/apps/files/tests/js/fileUploadSpec.js b/apps/files/tests/js/fileUploadSpec.js
index 64006d71e42..06b0574becb 100644
--- a/apps/files/tests/js/fileUploadSpec.js
+++ b/apps/files/tests/js/fileUploadSpec.js
@@ -69,6 +69,7 @@ describe('OC.Upload tests', function() {
files: [file],
jqXHR: jqXHR,
response: sinon.stub().returns(jqXHR),
+ targetDir: "/",
submit: sinon.stub(),
abort: sinon.stub()
};