mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
[VD:abstract] sanitize Illegal characters of file system in getItemsInHand()
This commit is contained in:
@@ -4301,7 +4301,13 @@ abstract class elFinderVolumeDriver
|
||||
*/
|
||||
protected function getItemsInHand($hashes, $dir = null, $canLink = null)
|
||||
{
|
||||
static $banChrs = null;
|
||||
static $totalSize = 0;
|
||||
|
||||
if (is_null($banChrs)) {
|
||||
$banChrs = DIRECTORY_SEPARATOR !== '/'? array('\\', '/', ':', '*', '?', '"', '<', '>', '|') : array('\\', '/');
|
||||
}
|
||||
|
||||
if (is_null($dir)) {
|
||||
$totalSize = 0;
|
||||
if (!$tmpDir = $this->getTempPath()) {
|
||||
@@ -4328,6 +4334,11 @@ abstract class elFinderVolumeDriver
|
||||
}
|
||||
|
||||
$name = $file['name'];
|
||||
// remove ctrl characters
|
||||
$name = preg_replace('/[[:cntrl:]]+/', '', $name);
|
||||
// replace ban characters
|
||||
$name = str_replace($banChrs, '_', $name);
|
||||
|
||||
// for call from search results
|
||||
if (isset($files[$name])) {
|
||||
$name = preg_replace('/^(.*?)(\..*)?$/', '$1_' . $files[$name]++ . '$2', $name);
|
||||
|
||||
Reference in New Issue
Block a user