diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index d9a48185d0..8622932dd1 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -969,6 +969,10 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper { $path = substr($path,0,-1); } + if (empty($path)) + { + return false; // is invalid and gives sql error + } // check if we already have the info from the last dir_open call, as the old vfs reads it anyway from the db if (self::$stat_cache && isset(self::$stat_cache[$path]) && (is_null($eacl_access) || self::$stat_cache[$path] !== false)) { diff --git a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php index 3206b268c0..622684c79b 100644 --- a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php @@ -1018,14 +1018,18 @@ class vfs_stream_wrapper implements iface_stream_wrapper */ static protected function get_path($path,$only_remove_scheme=self::SCHEME) { - if ($path[0] != '/' && (!$only_remove_scheme || parse_url($path,PHP_URL_SCHEME) == $only_remove_scheme)) + $url_parts = parse_url($path); + if ($path[0] != '/' && (!$only_remove_scheme || $url_parts['scheme'] == $only_remove_scheme)) { - $path = parse_url($path,PHP_URL_PATH); + $path = $url_parts['path']; } // remove trailing slashes eg. added by WebDAV - while (substr($path,-1) == '/' && $path != '/') + if ($url_parts['path'] != '/') { - $path = substr($path,0,-1); + while (substr($path,-1) == '/' && $path != '/') + { + $path = substr($path,0,-1); + } } return $path; }