diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-07-11 15:15:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 15:15:49 +0200 |
commit | 4153e1de795d0977756583e5845f849662ed6528 (patch) | |
tree | 7ab82c1e4058723d5c9fba461b74b7c65fabc5d5 /apps | |
parent | 23ff76975fb0c81aa8e27d6b9dbfe0ba1f263cd1 (diff) | |
parent | e1d6ca3c53a12e6fea761c41dfcb2be2e6ed174d (diff) | |
download | nextcloud-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.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 20 |
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; |