Merge pull request #5692 from nextcloud/upload-hidden-filelist-12
[12] properly block file upload to non-active filelist
This commit is contained in:
commit
701a865db7
|
@ -2737,6 +2737,7 @@
|
||||||
|
|
||||||
if (self.$el.hasClass('hidden')) {
|
if (self.$el.hasClass('hidden')) {
|
||||||
// do not upload to invisible lists
|
// do not upload to invisible lists
|
||||||
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2748,6 +2749,7 @@
|
||||||
&& !self.$el.has(dropTarget).length // dropped inside list
|
&& !self.$el.has(dropTarget).length // dropped inside list
|
||||||
&& !dropTarget.is(self.$container) // dropped on main container
|
&& !dropTarget.is(self.$container) // dropped on main container
|
||||||
) {
|
) {
|
||||||
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2694,22 +2694,24 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
var eventData = {
|
var eventData = {
|
||||||
delegatedEvent: {
|
delegatedEvent: {
|
||||||
target: $target
|
target: $target
|
||||||
|
},
|
||||||
|
preventDefault: function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
uploader.trigger('drop', eventData, data || {});
|
uploader.trigger('drop', eventData, data || {});
|
||||||
return !!data.targetDir;
|
return !!data.targetDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
it('drop on a tr or crumb outside file list does not trigger upload', function() {
|
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 $anotherTable = $('<table><tbody><tr><td>outside<div class="crumb">crumb</div></td></tr></table>');
|
||||||
var ev;
|
var ev;
|
||||||
$('#testArea').append($anotherTable);
|
$('#testArea').append($anotherTable);
|
||||||
ev = dropOn($anotherTable.find('tr'), uploadData);
|
ev = dropOn($anotherTable.find('tr'), uploadData);
|
||||||
expect(ev).toEqual(false);
|
expect(ev).toEqual(false);
|
||||||
|
|
||||||
ev = dropOn($anotherTable.find('.crumb'), uploadData);
|
ev = dropOn($anotherTable.find('.crumb'), uploadData);
|
||||||
expect(ev).toEqual(false);
|
expect(ev).toEqual(false);
|
||||||
});
|
});
|
||||||
it('drop on an element outside file list container does not trigger upload', function() {
|
it('drop on an element outside file list container does not trigger upload', function() {
|
||||||
var $anotherEl = $('<div>outside</div>');
|
var $anotherEl = $('<div>outside</div>');
|
||||||
var ev;
|
var ev;
|
||||||
|
|
|
@ -560,6 +560,7 @@ return array(
|
||||||
'OC\\Files\\Cache\\Wrapper\\CacheJail' => $baseDir . '/lib/private/Files/Cache/Wrapper/CacheJail.php',
|
'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\\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\\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\\CachedMountInfo' => $baseDir . '/lib/private/Files/Config/CachedMountInfo.php',
|
||||||
'OC\\Files\\Config\\LazyStorageMountInfo' => $baseDir . '/lib/private/Files/Config/LazyStorageMountInfo.php',
|
'OC\\Files\\Config\\LazyStorageMountInfo' => $baseDir . '/lib/private/Files/Config/LazyStorageMountInfo.php',
|
||||||
'OC\\Files\\Config\\MountProviderCollection' => $baseDir . '/lib/private/Files/Config/MountProviderCollection.php',
|
'OC\\Files\\Config\\MountProviderCollection' => $baseDir . '/lib/private/Files/Config/MountProviderCollection.php',
|
||||||
|
|
|
@ -590,6 +590,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
||||||
'OC\\Files\\Cache\\Wrapper\\CacheJail' => __DIR__ . '/../../..' . '/lib/private/Files/Cache/Wrapper/CacheJail.php',
|
'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\\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\\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\\CachedMountInfo' => __DIR__ . '/../../..' . '/lib/private/Files/Config/CachedMountInfo.php',
|
||||||
'OC\\Files\\Config\\LazyStorageMountInfo' => __DIR__ . '/../../..' . '/lib/private/Files/Config/LazyStorageMountInfo.php',
|
'OC\\Files\\Config\\LazyStorageMountInfo' => __DIR__ . '/../../..' . '/lib/private/Files/Config/LazyStorageMountInfo.php',
|
||||||
'OC\\Files\\Config\\MountProviderCollection' => __DIR__ . '/../../..' . '/lib/private/Files/Config/MountProviderCollection.php',
|
'OC\\Files\\Config\\MountProviderCollection' => __DIR__ . '/../../..' . '/lib/private/Files/Config/MountProviderCollection.php',
|
||||||
|
|
Loading…
Reference in New Issue