mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
fixed missing .ics extension in Location header after PUT
This commit is contained in:
parent
477193b165
commit
bc59bd9fb8
@ -50,6 +50,28 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
$this->bo =& new calendar_boupdate();
|
$this->bo =& new calendar_boupdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PATH_ATTRIBUTE = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the path for an event
|
||||||
|
*
|
||||||
|
* @param array|int $event
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function get_path($event)
|
||||||
|
{
|
||||||
|
if (is_numeric($event) && self::PATH_ATTRIBUTE == 'id')
|
||||||
|
{
|
||||||
|
$name = $event;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!is_array($event)) $event = $this->bo->read($event);
|
||||||
|
$name = $event[self::PATH_ATTRIBUTE];
|
||||||
|
}
|
||||||
|
return '/calendar/'.$name.'.ics';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle propfind in the calendar folder
|
* Handle propfind in the calendar folder
|
||||||
*
|
*
|
||||||
@ -116,7 +138,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
$props[] = HTTP_WebDAV_Server::mkprop('getcontentlength', ''); // expensive to calculate and no CalDAV client uses it
|
$props[] = HTTP_WebDAV_Server::mkprop('getcontentlength', ''); // expensive to calculate and no CalDAV client uses it
|
||||||
}
|
}
|
||||||
$files['files'][] = array(
|
$files['files'][] = array(
|
||||||
'path' => '/calendar/'.$event['id'].'.ics',
|
'path' => self::get_path($event),
|
||||||
'props' => $props,
|
'props' => $props,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -284,7 +306,7 @@ class calendar_groupdav extends groupdav_handler
|
|||||||
if (is_null($event) || !$return_no_access) // let lightning think the event is added
|
if (is_null($event) || !$return_no_access) // let lightning think the event is added
|
||||||
{
|
{
|
||||||
if ($this->debug) error_log(__METHOD__."(,$id,$user) cal_id=$cal_id, is_null(\$event)=".(int)is_null($event));
|
if ($this->debug) error_log(__METHOD__."(,$id,$user) cal_id=$cal_id, is_null(\$event)=".(int)is_null($event));
|
||||||
header('Location: '.$this->base_uri.'/calendar/'.$cal_id);
|
header('Location: '.$this->base_uri.self::get_path($cal_id));
|
||||||
return '201 Created';
|
return '201 Created';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,6 +37,28 @@ class infolog_groupdav extends groupdav_handler
|
|||||||
$this->bo =& new infolog_bo();
|
$this->bo =& new infolog_bo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PATH_ATTRIBUTE = 'info_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the path for an event
|
||||||
|
*
|
||||||
|
* @param array|int $info
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function get_path($info)
|
||||||
|
{
|
||||||
|
if (is_numeric($info) && self::PATH_ATTRIBUTE == 'info_id')
|
||||||
|
{
|
||||||
|
$name = $info;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!is_array($info)) $info = $this->bo->read($info);
|
||||||
|
$name = $info[self::PATH_ATTRIBUTE];
|
||||||
|
}
|
||||||
|
return '/calendar/'.$name.'.ics';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle propfind in the infolog folder
|
* Handle propfind in the infolog folder
|
||||||
*
|
*
|
||||||
@ -66,7 +88,7 @@ class infolog_groupdav extends groupdav_handler
|
|||||||
foreach($tasks as $task)
|
foreach($tasks as $task)
|
||||||
{
|
{
|
||||||
$files['files'][] = array(
|
$files['files'][] = array(
|
||||||
'path' => '/infolog/'.$task['info_id'].'.ics',
|
'path' => self::get_path($task),
|
||||||
'props' => array(
|
'props' => array(
|
||||||
HTTP_WebDAV_Server::mkprop('getetag',$this->get_etag($task)),
|
HTTP_WebDAV_Server::mkprop('getetag',$this->get_etag($task)),
|
||||||
HTTP_WebDAV_Server::mkprop('getcontenttype',$this->agent != 'kde' ?
|
HTTP_WebDAV_Server::mkprop('getcontenttype',$this->agent != 'kde' ?
|
||||||
@ -126,7 +148,7 @@ class infolog_groupdav extends groupdav_handler
|
|||||||
header('ETag: '.$this->get_etag($info_id));
|
header('ETag: '.$this->get_etag($info_id));
|
||||||
if (is_null($ok) || $id != $info_id)
|
if (is_null($ok) || $id != $info_id)
|
||||||
{
|
{
|
||||||
header('Location: '.$this->base_uri.'/infolog/'.$info_id);
|
header('Location: '.$this->base_uri.self::get_path($info_id));
|
||||||
return '201 Created';
|
return '201 Created';
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user