WP_Filesystem: Return symlinked directory names correctly, previously the FTP extensions would return it as 'source -> dest' instead of simply 'source'. Props kurtpayne. Fixes #17846

git-svn-id: https://develop.svn.wordpress.org/trunk@21223 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2012-07-06 11:39:39 +00:00
parent 641b92e43d
commit b47a1a46e5
2 changed files with 8 additions and 0 deletions

View File

@ -330,6 +330,10 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
}
}
// Replace symlinks formatted as "source -> target" with just the source name
if ( $b['islink'] )
$b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] );
return $b;
}

View File

@ -318,6 +318,10 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
$struc['files'] = array();
}
// Replace symlinks formatted as "source -> target" with just the source name
if ( $struc['islink'] )
$struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] );
$ret[ $struc['name'] ] = $struc;
}
return $ret;