From c76633bb8aabff7f160d1b5cd0b7f2a259d009a7 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Tue, 25 Apr 2017 18:20:32 +0200 Subject: require at least one param or prop filter element Signed-off-by: Georg Ehrke --- apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apps/dav/lib/CalDAV/Search') diff --git a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php index 2c92a41e16b..4d22f310c24 100644 --- a/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php +++ b/apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php @@ -143,7 +143,7 @@ class CalendarSearchReport implements XmlDeserializable { throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); } - $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters'])); + $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); $noCompsDefined = empty($newProps['filters']['comps']); if ($propsOrParamsDefined && $noCompsDefined) { throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); @@ -153,6 +153,10 @@ class CalendarSearchReport implements XmlDeserializable { throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); } + if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { + throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); + } + $obj = new self(); foreach ($newProps as $key => $value) { -- cgit v1.2.3