[Finder] fixed root directory access for ftp/sftp wrapper

This commit is contained in:
Gerd Christian Kunze 2018-09-26 12:57:02 +02:00 committed by Fabien Potencier
parent 2a605c2ed6
commit 9630a38d67

View File

@ -732,12 +732,20 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Normalizes given directory names by removing trailing slashes.
*
* Excluding: (s)ftp:// wrapper
*
* @param string $dir
*
* @return string
*/
private function normalizeDir($dir)
{
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
if (preg_match('#^s?ftp://#', $dir)) {
$dir .= '/';
}
return $dir;
}
}