"fixed not working egw_vfs::dirname if result should be '/', eg. egw_vfs::dirname('/home)"

This commit is contained in:
Ralf Becker 2009-04-15 21:09:04 +00:00
parent 823a3ab4c0
commit 9e34658599

View File

@ -977,12 +977,13 @@ class egw_vfs extends vfs_stream_wrapper
{ {
if ($url == '/' || $url[0] != '/' && parse_url($url,PHP_URL_PATH) == '/') if ($url == '/' || $url[0] != '/' && parse_url($url,PHP_URL_PATH) == '/')
{ {
//error_log(__METHOD__."($url) returning FALSE: already in root!");
return false; return false;
} }
$parts = explode('/',$url); $parts = explode('/',$url);
if (substr($url,-1) == '/') array_pop($parts); if (substr($url,-1) == '/') array_pop($parts);
array_pop($parts); array_pop($parts);
if ($url[0] != '/' && count($parts) == 3) if ($url[0] != '/' && count($parts) == 3 || count($parts) == 1 && $parts[0] === '')
{ {
array_push($parts,''); // scheme://host is wrong (no path), has to be scheme://host/ array_push($parts,''); // scheme://host is wrong (no path), has to be scheme://host/
} }