mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 05:11:41 +02:00
use full url-encoding for all clients as required by most clients and RFC
This commit is contained in:
parent
630c340ce8
commit
dd8e9c6269
@ -2692,44 +2692,21 @@ class HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private minimalistic version of PHP urlencode()
|
* private URL encoding
|
||||||
*
|
*
|
||||||
* only blanks, percent and XML special chars must be encoded here
|
* We use now full url-encoding as required by WebDAV RFC and many clients.
|
||||||
* full urlencode() encoding confuses some clients ...
|
* Formerly HTTP_WebDAV_Server used to encode only: " %&<>+"
|
||||||
*
|
*
|
||||||
* @param string URL to encode
|
* @param string URL to encode
|
||||||
* @return string encoded URL
|
* @return string encoded URL
|
||||||
* @todo check if other not explicitly named user-agents are happy with full url-encoding too and we can make it the default
|
|
||||||
*/
|
*/
|
||||||
public static function _urlencode($url)
|
public static function _urlencode($url)
|
||||||
{
|
|
||||||
// cadaver (and probably all neon using agents) need a more complete url encoding
|
|
||||||
// otherwise special chars like "$,()'" in filenames do NOT work
|
|
||||||
if (strpos($_SERVER['HTTP_USER_AGENT'],'neon') !== false ||
|
|
||||||
// old netdrive does NOT use a User-Agent, but requires full urlencoding for non-ascii chars (eg. German Umlauts)
|
|
||||||
!isset($_SERVER['HTTP_USER_AGENT']) ||
|
|
||||||
// current netdrive uses "NetDrive 2.5.8" as user-agent
|
|
||||||
stripos($_SERVER['HTTP_USER_AGENT'],'NetDrive') !== false ||
|
|
||||||
// Cyberduck or Mountain Duck WebDAV clients
|
|
||||||
stripos($_SERVER['HTTP_USER_AGENT'],'Cyberduck') !== false ||
|
|
||||||
stripos($_SERVER['HTTP_USER_AGENT'],'Mountain Duck') !== false ||
|
|
||||||
// OS X Finder (WebDAVFS/3.0.0 (03008000) Darwin/14.3.0 (x86_64))
|
|
||||||
stripos($_SERVER['HTTP_USER_AGENT'],'WebDAVFS') !== false && stripos($_SERVER['HTTP_USER_AGENT'],'Darwin'))
|
|
||||||
{
|
{
|
||||||
return strtr(rawurlencode($url),array(
|
return strtr(rawurlencode($url),array(
|
||||||
'%2F' => '/',
|
'%2F' => '/',
|
||||||
'%3A' => ':',
|
'%3A' => ':',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
//error_log( __METHOD__."\n" .print_r($url,true));
|
|
||||||
return strtr($url, array(' ' => '%20',
|
|
||||||
'%' => '%25',
|
|
||||||
'&' => '%26',
|
|
||||||
'<' => '%3C',
|
|
||||||
'>' => '%3E',
|
|
||||||
'+' => '%2B',
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private version of PHP urldecode
|
* private version of PHP urldecode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user