Merge pull request #5692 from nextcloud/upload-hidden-filelist-12

[12] properly block file upload to non-active filelist
This commit is contained in:
Morris Jobke 2017-07-13 11:47:46 +02:00 committed by GitHub
commit 701a865db7
4 changed files with 15 additions and 9 deletions

View File

@ -2737,6 +2737,7 @@
if (self.$el.hasClass('hidden')) {
// do not upload to invisible lists
e.preventDefault();
return false;
}
@ -2748,6 +2749,7 @@
&& !self.$el.has(dropTarget).length // dropped inside list
&& !dropTarget.is(self.$container) // dropped on main container
) {
e.preventDefault();
return false;
}

View File

@ -2694,22 +2694,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;

View File

@ -560,6 +560,7 @@ return array(
'OC\\Files\\Cache\\Wrapper\\CacheJail' => $baseDir . '/lib/private/Files/Cache/Wrapper/CacheJail.php',
'OC\\Files\\Cache\\Wrapper\\CachePermissionsMask' => $baseDir . '/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php',
'OC\\Files\\Cache\\Wrapper\\CacheWrapper' => $baseDir . '/lib/private/Files/Cache/Wrapper/CacheWrapper.php',
'OC\\Files\\Cache\\Wrapper\\JailPropagator' => $baseDir . '/lib/private/Files/Cache/Wrapper/JailPropagator.php',
'OC\\Files\\Config\\CachedMountInfo' => $baseDir . '/lib/private/Files/Config/CachedMountInfo.php',
'OC\\Files\\Config\\LazyStorageMountInfo' => $baseDir . '/lib/private/Files/Config/LazyStorageMountInfo.php',
'OC\\Files\\Config\\MountProviderCollection' => $baseDir . '/lib/private/Files/Config/MountProviderCollection.php',

View File

@ -590,6 +590,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Files\\Cache\\Wrapper\\CacheJail' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Wrapper/CacheJail.php',
'OC\\Files\\Cache\\Wrapper\\CachePermissionsMask' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Wrapper/CachePermissionsMask.php',
'OC\\Files\\Cache\\Wrapper\\CacheWrapper' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Wrapper/CacheWrapper.php',
'OC\\Files\\Cache\\Wrapper\\JailPropagator' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Wrapper/JailPropagator.php',
'OC\\Files\\Config\\CachedMountInfo' => __DIR__ . '/../../..' . '/lib/private/Files/Config/CachedMountInfo.php',
'OC\\Files\\Config\\LazyStorageMountInfo' => __DIR__ . '/../../..' . '/lib/private/Files/Config/LazyStorageMountInfo.php',
'OC\\Files\\Config\\MountProviderCollection' => __DIR__ . '/../../..' . '/lib/private/Files/Config/MountProviderCollection.php',