From 12c9b1efb077a45a6ef0bf29ac7e5b149539cf49 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 10 Jul 2017 14:32:10 +0200 Subject: properly block file upload to non-active filelist Signed-off-by: Robin Appelman --- apps/files/js/filelist.js | 2 ++ 1 file changed, 2 insertions(+) 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; } -- cgit v1.2.3 From e1d6ca3c53a12e6fea761c41dfcb2be2e6ed174d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 11 Jul 2017 14:01:16 +0200 Subject: fix test Signed-off-by: Robin Appelman --- apps/files/tests/js/filelistSpec.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 = $('
outside
crumb
'); - 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 = $('
outside
crumb
'); + 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 = $('
outside
'); var ev; -- cgit v1.2.3