mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 11:23:54 +01:00
fix not working download url for share on a subdirectory of a mounted filesystem with given download url
This commit is contained in:
parent
d399bb72f2
commit
c823f64c4b
@ -197,9 +197,10 @@ class StreamWrapper implements StreamWrapperIface
|
|||||||
* @param boolean $do_symlink =true is a direct match allowed, default yes (must be false for a lstat or readlink!)
|
* @param boolean $do_symlink =true is a direct match allowed, default yes (must be false for a lstat or readlink!)
|
||||||
* @param boolean $use_symlinkcache =true
|
* @param boolean $use_symlinkcache =true
|
||||||
* @param boolean $replace_user_pass_host =true replace $user,$pass,$host in url, default true, if false result is not cached
|
* @param boolean $replace_user_pass_host =true replace $user,$pass,$host in url, default true, if false result is not cached
|
||||||
|
* @param boolean $fix_url_query =false true append relativ path to url query parameter, default not
|
||||||
* @return string|boolean false if the url cant be resolved, should not happen if fstab has a root entry
|
* @return string|boolean false if the url cant be resolved, should not happen if fstab has a root entry
|
||||||
*/
|
*/
|
||||||
static function resolve_url($_path,$do_symlink=true,$use_symlinkcache=true,$replace_user_pass_host=true)
|
static function resolve_url($_path,$do_symlink=true,$use_symlinkcache=true,$replace_user_pass_host=true,$fix_url_query=false)
|
||||||
{
|
{
|
||||||
$path = self::get_path($_path);
|
$path = self::get_path($_path);
|
||||||
|
|
||||||
@ -246,6 +247,13 @@ class StreamWrapper implements StreamWrapperIface
|
|||||||
}
|
}
|
||||||
$url = Vfs::concat($url,substr($parts['path'],strlen($mounted)));
|
$url = Vfs::concat($url,substr($parts['path'],strlen($mounted)));
|
||||||
|
|
||||||
|
// if url contains url parameter, eg. from filesystem streamwrapper, we need to append relative path here too
|
||||||
|
$matches = null;
|
||||||
|
if ($fix_url_query && preg_match('|([?&]url=)([^&]+)|', $url, $matches))
|
||||||
|
{
|
||||||
|
$url = str_replace($matches[0], $matches[1].Vfs::concat($matches[2], substr($parts['path'],strlen($mounted))), $url);
|
||||||
|
}
|
||||||
|
|
||||||
if ($replace_user_pass_host)
|
if ($replace_user_pass_host)
|
||||||
{
|
{
|
||||||
$url = str_replace(array('$user','$pass','$host','$home'),array($parts['user'],$parts['pass'],$parts['host'],$parts['home']),$url);
|
$url = str_replace(array('$user','$pass','$host','$home'),array($parts['user'],$parts['pass'],$parts['host'],$parts['home']),$url);
|
||||||
|
@ -204,7 +204,7 @@ class egw_sharing
|
|||||||
$GLOBALS['egw_info']['server']['vfs_fstab'] = egw_vfs::mount();
|
$GLOBALS['egw_info']['server']['vfs_fstab'] = egw_vfs::mount();
|
||||||
egw_vfs::clearstatcache();
|
egw_vfs::clearstatcache();
|
||||||
}
|
}
|
||||||
$share['resolve_url'] = egw_vfs::resolve_url($share['share_path']);
|
$share['resolve_url'] = egw_vfs::resolve_url($share['share_path'], true, true, true, true); // true = fix evtl. contained url parameter
|
||||||
// if share not writable append ro=1 to mount url to make it readonly
|
// if share not writable append ro=1 to mount url to make it readonly
|
||||||
if (!self::$db->from_bool($share['share_writable']))
|
if (!self::$db->from_bool($share['share_writable']))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user