Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2021-11-08 14:22:57 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-11-08 20:18:51 +0300
commitb076968cc23084ae1bfae645e18f6ada62926b8f (patch)
tree2a0e2d55c953ddc7f4ad20367ff435d38d33a34d /apps/files
parent43652ca5426842f4ea9f28ac44f9696e9a2b1acd (diff)
refs #11864 handle empty dir drop in Files UI
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/file-upload.js6
-rw-r--r--apps/files/js/jquery.fileupload.js16
2 files changed, 19 insertions, 3 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 672fc1d770b..7ab88ed61bd 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -215,6 +215,12 @@ OC.FileUpload.prototype = {
var data = this.data;
var file = this.getFile();
+ // if file is a directory, just create it
+ // files are handled separately
+ if (file.isDirectory) {
+ return this.uploader.ensureFolderExists(OC.joinPaths(this._targetFolder, file.fullPath));
+ }
+
if (self.aborted === true) {
return $.Deferred().resolve().promise();
}
diff --git a/apps/files/js/jquery.fileupload.js b/apps/files/js/jquery.fileupload.js
index ea8529f3226..cc0c97ba3ed 100644
--- a/apps/files/js/jquery.fileupload.js
+++ b/apps/files/js/jquery.fileupload.js
@@ -1029,7 +1029,12 @@
} else {
paramNameSet = paramName;
}
- data.originalFiles = files;
+ data.originalFiles = [];
+ $.each(files, function (file) {
+ if (!file.isDirectory) {
+ data.originalFiles.push(file);
+ }
+ });
$.each(fileSet || files, function (index, element) {
var newData = $.extend({}, data);
newData.files = fileSet ? element : [element];
@@ -1098,7 +1103,12 @@
entries,
path + entry.name + '/'
).done(function (files) {
- dfd.resolve(files);
+ // empty folder
+ if (!files.length && entry.isDirectory) {
+ dfd.resolve(entry);
+ } else {
+ dfd.resolve(files);
+ }
}).fail(errorHandler);
},
readEntries = function () {
@@ -1486,4 +1496,4 @@
});
-})); \ No newline at end of file
+}));