1
0
mirror of https://github.com/danog/tgseclib.git synced 2025-01-22 05:51:20 +01:00

/home and /home/ should return the same thing for rawlist() and nlist() (thanks pioyu!)

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@167 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-06-25 15:06:43 +00:00
parent 3da6c0d608
commit 38f1bd487f

View File

@ -478,12 +478,12 @@ class Net_SFTP extends Net_SSH2 {
// if the SFTP server returned the canonicalized path even for non-existant files this wouldn't be necessary // if the SFTP server returned the canonicalized path even for non-existant files this wouldn't be necessary
// on OpenSSH it isn't necessary but on other SFTP servers it is. that and since the specs say nothing on // on OpenSSH it isn't necessary but on other SFTP servers it is. that and since the specs say nothing on
// the subject, we'll go ahead and work around it with the following. // the subject, we'll go ahead and work around it with the following.
if ($dir[strlen($dir) - 1] != '/') { if (empty($dir) || $dir[strlen($dir) - 1] != '/') {
$file = basename($dir); $file = basename($dir);
$dir = dirname($dir); $dir = dirname($dir);
} }
$dir = rtrim($dir, '/'); $dir = $dir[0] == '/' ? '/' . rtrim(substr($dir, 1), '/') : rtrim($dir, '/');
if ($dir == '.' || $dir == $this->pwd) { if ($dir == '.' || $dir == $this->pwd) {
return $this->pwd . $file; return $this->pwd . $file;