correctly handle uid/name-part of path containing #%?

This commit is contained in:
Ralf Becker 2011-10-06 07:51:24 +00:00
parent 9b8dccb16d
commit e654d3fbfb
2 changed files with 9 additions and 3 deletions

View File

@ -351,7 +351,7 @@ class groupdav extends HTTP_WebDAV_Server
{
// principals collection
$files['files'][] = $this->add_collection('/principals/', array(
'displayname' => lang('Accounts'),
'displayname' => lang('Accounts'),
));
// todo: account_selection owngroups and none!!!
foreach($this->accounts->search(array('type' => 'both')) as $account)
@ -833,7 +833,12 @@ class groupdav extends HTTP_WebDAV_Server
$name = basename($file['path']);
}
echo "\t<tr class='$class'>\n\t\t<td>$n</td>\n\t\t<td>".html::a_href(htmlspecialchars($name),'/groupdav.php'.$file['path'])."</td>\n";
echo "\t<tr class='$class'>\n\t\t<td>$n</td>\n\t\t<td>".
html::a_href(htmlspecialchars($name),'/groupdav.php'.strtr($file['path'], array(
'%' => '%25',
'#' => '%23',
'?' => '%3F',
)))."</td>\n";
echo "\t\t<td>".$props['DAV:getcontentlength']."</td>\n";
echo "\t\t<td>".(!empty($props['DAV:getlastmodified']) ? date('Y-m-d H:i:s',$props['DAV:getlastmodified']) : '')."</td>\n";
echo "\t\t<td>".$props['DAV:getetag']."</td>\n";

View File

@ -484,7 +484,8 @@ abstract class groupdav_handler
$type = $this->accounts->get_type($entry['owner']) == 'u' ? 'users' : 'groups';
$props['owner'] = HTTP_WebDAV_Server::mkprop('href', $this->base_uri.'/principals/'.$type.'/'.$account_lid.'/');
}
return $this->groupdav->add_resource($path.$this->get_path($entry), $props, $privileges);
// we urldecode here, as HTTP_WebDAV_Server uses a minimal (#?%) urlencoding for incomming pathes and urlencodes pathes in propfind
return $this->groupdav->add_resource($path.urldecode($this->get_path($entry)), $props, $privileges);
}
}