diff --git a/filesystem/File.php b/filesystem/File.php index ee7db78a2..6485c21e2 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -297,6 +297,10 @@ class File extends DataObject { $name = ereg_replace(' +','-',trim($name)); $name = ereg_replace('[^A-Za-z0-9.+_\-]','',$name); + while($name[0] == '_' || $name[0] == '.') { + $name = substr($name, 1); + } + // We might have just turned it blank, so check again. if(!$name) $name = 'new-folder'; diff --git a/filesystem/Folder.php b/filesystem/Folder.php index b33ac8137..e42383bfd 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -119,12 +119,10 @@ class Folder extends File { if(file_exists($baseDir)) { $actualChildren = scandir($baseDir); foreach($actualChildren as $actualChild) { - if($actualChild[0] == '.') continue; // ignore hidden files - if(substr($actualChild,0,6) == 'Thumbs') continue; // ignore windows cache stuff - if($actualChild == '_resampled') continue; // ignore the resampled copies of images - if($actualChild == '_tmp') continue; // ignore tmp folder for PhotoEditor. - - + if($actualChild[0] == '.' || $actualChild[0] == '_' || substr($actualChild,0,6) == 'Thumbs') { + continue; + } + // A record with a bad class type doesn't deserve to exist. It must be purged! if(isset($hasDbChild[$actualChild])) { $child = $hasDbChild[$actualChild]; @@ -222,6 +220,10 @@ class Folder extends File { $file = ereg_replace('[^A-Za-z0-9+.-]+','',$file); $file = ereg_replace('-+', '-',$file); + while($file[0] == '_' || $file[0] == '.') { + $file = substr($file, 1); + } + $file = $this->RelativePath . $file; Filesystem::makeFolder(dirname("$base/$file"));