8000 bug #28604 [Finder] fixed root directory access for ftp/sftp wrapper … · symfony/symfony@636eb9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 636eb9e

Browse files
committed
bug #28604 [Finder] fixed root directory access for ftp/sftp wrapper (DerDu)
This PR was squashed before being merged into the 3.4 branch (closes #28604). Discussion ---------- [Finder] fixed root directory access for ftp/sftp wrapper | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27423 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> This fixes a flaw introduced in 3.4.7 by #26763 In order to access the root folder with ftp wrapper, there MUST BE a slash present. - Currently: from 3.4.7 on it just ```rtrim``` all seperators (```/```, ```\```) from directories - Now: IF the directory is a (s)ftp:// wrapper (```#^s?ftp://#```) this fix just adds a slash (```/```) again Commits ------- 9630a38 [Finder] fixed root directory access for ftp/sftp wrapper
2 parents 728ab53 + 9630a38 commit 636eb9e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Symfony/Component/Finder/Finder.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,20 @@ private function searchInDirectory($dir)
732732
/**
733733
* Normalizes given directory names by removing trailing slashes.
734734
*
735+
* Excluding: (s)ftp:// wrapper
736+
*
735737
* @param string $dir
736738
*
737739
* @return string
738740
*/
739741
private function normalizeDir($dir)
740742
{
741-
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
743+
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
744+
745+
if (preg_match('#^s?ftp://#', $dir)) {
746+
$dir .= '/';
747+
}
748+
749+
return $dir;
742750
}
743751
}

0 commit comments

Comments
 (0)
0