mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Exclude symlinks from Vfs
This commit is contained in:
parent
abc1ccc8f1
commit
f26b271067
@ -384,7 +384,7 @@ class Vfs
|
||||
*
|
||||
* @param string|array $base base of the search
|
||||
* @param array $options =null the following keys are allowed:
|
||||
* - type => {d|f|F} d=dirs, f=files (incl. symlinks), F=files (incl. symlinks to files), default all
|
||||
* - type => {d|f|F|!l} d=dirs, f=files (incl. symlinks), F=files (incl. symlinks to files), !l=no symlinks, default all
|
||||
* - depth => {true|false(default)} put the contents of a dir before the dir itself
|
||||
* - dirsontop => {true(default)|false} allways return dirs before the files (two distinct blocks)
|
||||
* - mindepth,maxdepth minimal or maximal depth to be returned
|
||||
@ -646,7 +646,8 @@ class Vfs
|
||||
return; // not found, should not happen
|
||||
}
|
||||
if ($type && (($type == 'd') == !($stat['mode'] & Vfs\Sqlfs\StreamWrapper::MODE_DIR) || // != is_dir() which can be true for symlinks
|
||||
$type == 'F' && is_dir($path))) // symlink to a directory
|
||||
$type == 'F' && is_dir($path)) || // symlink to a directory
|
||||
$type == '!l' && ($stat['mode'] & Vfs::MODE_LINK)) // Symlink
|
||||
{
|
||||
return; // wrong type
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ class Sharing
|
||||
}
|
||||
|
||||
// We don't allow sharing links, share target instead
|
||||
if($target = Vfs::readlink($path))
|
||||
if(($target = Vfs::readlink($path)))
|
||||
{
|
||||
$path = $target;
|
||||
}
|
||||
@ -761,5 +761,15 @@ if (file_exists(__DIR__.'/../../../filemanager/inc/class.filemanager_ui.inc.php'
|
||||
);
|
||||
return $actions;
|
||||
}
|
||||
|
||||
protected function get_vfs_options($query)
|
||||
{
|
||||
$options = parent::get_vfs_options($query);
|
||||
|
||||
// Hide symlinks
|
||||
$options['type'] = '!l';
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
}
|
@ -131,8 +131,8 @@ class SharingBase extends LoggedInTest
|
||||
$this->files += $this->addFiles($dir);
|
||||
|
||||
$logged_in_files = array_map(
|
||||
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
||||
Vfs::find($dir, static::VFS_OPTIONS)
|
||||
function($path) use ($dir) {return str_replace($dir, '/', $path);},
|
||||
Vfs::find($dir, static::VFS_OPTIONS)
|
||||
);
|
||||
|
||||
if(static::LOG_LEVEL > 1)
|
||||
@ -354,15 +354,16 @@ class SharingBase extends LoggedInTest
|
||||
);
|
||||
|
||||
// Symlinked file
|
||||
/*
|
||||
/* We don't test these because they don't work - the target will always
|
||||
* be outside the share root
|
||||
// Always says its empty
|
||||
$files[] = $symlink = $path.'symlink.txt';
|
||||
if(Vfs::file_exists($symlink)) Vfs::remove($symlink);
|
||||
$this->assertTrue(
|
||||
Vfs::symlink($file, $symlink),
|
||||
'Unable to create symlink'
|
||||
"Unable to create symlink $symlink => $file"
|
||||
);
|
||||
/*
|
||||
|
||||
// Symlinked dir
|
||||
$files[] = $symlinked_dir = $path.'sym_dir/';
|
||||
$this->assertTrue(
|
||||
|
Loading…
Reference in New Issue
Block a user