diff options
author | Georg Ehrke <developer@georgehrke.com> | 2017-04-25 18:20:32 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2017-04-25 18:20:32 +0200 |
commit | c76633bb8aabff7f160d1b5cd0b7f2a259d009a7 (patch) | |
tree | 5ab26ede6851538bda66d09915cd343e722f3f37 /apps | |
parent | ac3cc5211b4b3b5671afa2feefab15303270e25f (diff) | |
download | nextcloud-server-c76633bb8aabff7f160d1b5cd0b7f2a259d009a7.tar.gz nextcloud-server-c76633bb8aabff7f160d1b5cd0b7f2a259d009a7.zip |
require at least one param or prop filter element
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
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"?> |