* Filemanager/WebDAV: #?+ and chinese characters working now in filenames

This commit is contained in:
Ralf Becker 2011-09-05 10:25:28 +00:00
parent a13dfef19e
commit 366bad914d
2 changed files with 16 additions and 5 deletions

View File

@ -915,15 +915,18 @@ function force_download(_action, _senders)
{
$msg .= $_GET['msg'];
}
if (!($path = $_GET['path']) || !($stat = egw_vfs::lstat($path)))
if (!($path = str_replace(array('#','?'),array('%23','%3F'),$_GET['path'])) || // ?, # need to stay encoded!
// actions enclose pathes containing comma with "
($path[0] == '"' && substr($path,-1) == '"' && !($path = substr(str_replace('""','"',$path),1,-1))) ||
!($stat = egw_vfs::lstat($path)))
{
$msg .= lang('File or directory not found!');
$msg .= lang('File or directory not found!')." path='$path', stat=".array2string($stat);
}
else
{
$content = $stat;
$content['name'] = egw_vfs::basename($path);
$content['dir'] = dirname($path);
$content['dir'] = egw_vfs::decodePath(egw_vfs::dirname($path));
$content['path'] = $path;
$content['hsize'] = egw_vfs::hsize($stat['size']);
$content['mime'] = egw_vfs::mime_content_type($path);

View File

@ -251,6 +251,9 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
*/
function fileinfo($path)
{
// internally we require some url-encoding, as vfs_stream_wrapper uses URL's internally
$path = str_replace(array('#','?'),array('%23','%3F'),$path);
//error_log(__METHOD__."($path)");
// map URI path to filesystem path
$fspath = $this->base . $path;
@ -259,10 +262,15 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
$info = array();
// TODO remove slash append code when base class is able to do it itself
$info['path'] = is_dir($fspath) ? $this->_slashify($path) : $path;
// remove all urlencoding we need internally in EGw, HTTP_WebDAV_Server will add it's own!
// rawurldecode does NOT touch +
$info['path'] = rawurldecode($info['path']);
$info['props'] = array();
// no special beautified displayname here ...
$info['props'][] = HTTP_WebDAV_Server::mkprop ('displayname', egw_vfs::basename(self::_unslashify($path)));
$info['props'][] = HTTP_WebDAV_Server::mkprop ('displayname', egw_vfs::basename(self::_unslashify($info['path'])));
// creation and modification time
$info['props'][] = HTTP_WebDAV_Server::mkprop ('creationdate', filectime($fspath));
@ -304,7 +312,7 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
*/
// ToDo: etag from inode and modification time
//error_log(__METHOD__."($path) info=".print_r($info,true));
//error_log(__METHOD__."($path) info=".array2string($info));
return $info;
}