"fix concat to allow filenames containing \"..\""

This commit is contained in:
Ralf Becker 2009-03-24 17:19:38 +00:00
parent 3927555c22
commit cc9d7445c3

View File

@ -1004,14 +1004,12 @@ class egw_vfs extends vfs_stream_wrapper
$url = ($relative === '' || $relative[0] == '/' ? $url.$relative : $url.'/'.$relative);
// now normalize the path (remove "/something/..")
while (strpos($url,'..') !== false)
while (strpos($url,'/../') !== false)
{
list($a,$b) = explode('..',$url,2);
list($a,$b) = explode('/../',$url,2);
$a = explode('/',$a);
array_pop($a);
array_pop($a);
$b = explode('/',$b);
if ($b[0] === '') array_shift($b);
$url = implode('/',array_merge($a,$b));
}
return $url.($query ? '?'.$query : '');