diff --git a/libraries/joomla/filesystem/folder.php b/libraries/joomla/filesystem/folder.php index 65890455cc60b..f7e60dc08a679 100644 --- a/libraries/joomla/filesystem/folder.php +++ b/libraries/joomla/filesystem/folder.php @@ -616,7 +616,7 @@ protected static function _items($path, $filter, $recurse, $full, $exclude, $exc && (empty($excludefilter_string) || !preg_match($excludefilter_string, $file))) { // Compute the fullpath - $fullpath = $path . '/' . $file; + $fullpath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file; // Compute the isDir flag $isDir = is_dir($fullpath); diff --git a/libraries/joomla/form/fields/folderlist.php b/libraries/joomla/form/fields/folderlist.php index 259901aa27166..1f5f3667df0c0 100644 --- a/libraries/joomla/form/fields/folderlist.php +++ b/libraries/joomla/form/fields/folderlist.php @@ -189,6 +189,9 @@ protected function getOptions() $path = JPATH_ROOT . '/' . $path; } + $pathObject = new JFilesystemWrapperPath; + $path = $pathObject->check($path); + // Prepend some default options based on field attributes. if (!$this->hideNone) { @@ -218,7 +221,7 @@ protected function getOptions() } // Remove the root part and the leading / - $folder = trim(str_replace($path, '', $folder), '/'); + $folder = trim(str_replace($path, '', $folder), DIRECTORY_SEPARATOR); $options[] = JHtml::_('select.option', $folder, $folder); }