diff --git a/filesystem/Folder.php b/filesystem/Folder.php index 9f4b328c7..04695586e 100755 --- a/filesystem/Folder.php +++ b/filesystem/Folder.php @@ -42,7 +42,14 @@ class Folder extends File { $item = null; foreach($parts as $part) { if(!$part) continue; // happens for paths with a trailing slash - $item = DataObject::get_one("Folder", "\"Name\" = '$part' AND \"ParentID\" = $parentID"); + $item = DataObject::get_one( + "Folder", + sprintf( + "\"Name\" = '%s' AND \"ParentID\" = %d", + Convert::raw2sql($part), + (int)$parentID + ) + ); if(!$item) { $item = new Folder(); $item->ParentID = $parentID;