diff --git a/libraries/joomla/form/fields/folderlist.php b/libraries/joomla/form/fields/folderlist.php index 659e483f0a7f7..fea3c5105da0e 100644 --- a/libraries/joomla/form/fields/folderlist.php +++ b/libraries/joomla/form/fields/folderlist.php @@ -198,6 +198,9 @@ protected function getOptions() $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } + // Clean the $path contents + $path = JPath::clean($path); + // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $this->filter, $this->recursive, true); @@ -216,7 +219,7 @@ protected function getOptions() } // Remove the root part and the leading / - $folder = trim(str_replace($path, '', $folder), '/'); + $folder = trim(str_replace(rtrim($path, '/\\'), '', $folder), '/\\'); $options[] = JHtml::_('select.option', $folder, $folder); }