summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-07-11 15:15:49 +0200
committerGitHub <noreply@github.com>2017-07-11 15:15:49 +0200
commit4153e1de795d0977756583e5845f849662ed6528 (patch)
tree7ab82c1e4058723d5c9fba461b74b7c65fabc5d5 /apps
parent23ff76975fb0c81aa8e27d6b9dbfe0ba1f263cd1 (diff)
parente1d6ca3c53a12e6fea761c41dfcb2be2e6ed174d (diff)
downloadnextcloud-server-4153e1de795d0977756583e5845f849662ed6528.tar.gz
nextcloud-server-4153e1de795d0977756583e5845f849662ed6528.zip
Merge pull request #5672 from nextcloud/upload-hidden-filelist
properly block file upload to non-active filelist
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/tests/js/filelistSpec.js20
2 files changed, 13 insertions, 9 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 086e148e102..6cf12571ca0 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -2742,6 +2742,7 @@
if (self.$el.hasClass('hidden')) {
// do not upload to invisible lists
+ e.preventDefault();
return false;
}
@@ -2753,6 +2754,7 @@
&& !self.$el.has(dropTarget).length // dropped inside list
&& !dropTarget.is(self.$container) // dropped on main container
) {
+ e.preventDefault();
return false;
}
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index ddd9a45d153..41d202e9323 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -2808,22 +2808,24 @@ describe('OCA.Files.FileList tests', function() {
var eventData = {
delegatedEvent: {
target: $target
+ },
+ preventDefault: function () {
}
};
uploader.trigger('drop', eventData, data || {});
return !!data.targetDir;
}
- it('drop on a tr or crumb outside file list does not trigger upload', function() {
- var $anotherTable = $('<table><tbody><tr><td>outside<div class="crumb">crumb</div></td></tr></table>');
- var ev;
- $('#testArea').append($anotherTable);
- ev = dropOn($anotherTable.find('tr'), uploadData);
- expect(ev).toEqual(false);
+ it('drop on a tr or crumb outside file list does not trigger upload', function() {
+ var $anotherTable = $('<table><tbody><tr><td>outside<div class="crumb">crumb</div></td></tr></table>');
+ var ev;
+ $('#testArea').append($anotherTable);
+ ev = dropOn($anotherTable.find('tr'), uploadData);
+ expect(ev).toEqual(false);
- ev = dropOn($anotherTable.find('.crumb'), uploadData);
- expect(ev).toEqual(false);
- });
+ ev = dropOn($anotherTable.find('.crumb'), uploadData);
+ expect(ev).toEqual(false);
+ });
it('drop on an element outside file list container does not trigger upload', function() {
var $anotherEl = $('<div>outside</div>');
var ev;