mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
require at least one param or prop filter element
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
parent
ac3cc5211b
commit
c76633bb8a
2 changed files with 9 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue