diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CalDAV/Search/Xml/Request/CalendarSearchReport.php | 6 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php | 4 |
2 files changed, 9 insertions, 1 deletions
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) { diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index 15c776db07f..20bac8aa9f5 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -202,6 +202,10 @@ XML; $result = $this->parse($xml); } + /** + * @expectedException \Sabre\DAV\Exception\BadRequest + * @expectedExceptionMessage At least one{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter is required for this request + */ public function testCompOnly() { $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> |