mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 09:34:08 +02:00
add testSearchQueryInfiniteLoopEmptyLiteral().
This commit is contained in:
parent
c880b7edcd
commit
2f87fb84d3
2 changed files with 58 additions and 0 deletions
|
|
@ -526,4 +526,32 @@ class SearchPluginTest extends \PHPUnit_Framework_TestCase {
|
|||
$this->assertEquals(400, $response->getStatus());
|
||||
}
|
||||
|
||||
public function testSearchQueryInfiniteLoopEmptyLiteral() {
|
||||
$this->searchBackend->expects($this->any())
|
||||
->method('getArbiterPath')
|
||||
->willReturn('foo');
|
||||
|
||||
$plugin = new SearchPlugin($this->searchBackend);
|
||||
$server = new Server();
|
||||
$plugin->initialize($server);
|
||||
|
||||
$request = new Request('SEARCH', '/index.php/foo', [
|
||||
'Content-Type' => 'text/xml'
|
||||
]);
|
||||
$request->setBaseUrl('/index.php');
|
||||
$request->setBody(fopen(__DIR__ . '/infiniteloopemptyliteral.xml', 'r'));
|
||||
$response = new Response();
|
||||
|
||||
$this->searchBackend->expects($this->any())
|
||||
->method('isValidScope')
|
||||
->willReturn(true);
|
||||
|
||||
$this->searchBackend->expects($this->never())
|
||||
->method('search');
|
||||
|
||||
$plugin->searchHandler($request, $response);
|
||||
|
||||
$this->assertEquals(400, $response->getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
30
tests/infiniteloopemptyliteral.xml
Normal file
30
tests/infiniteloopemptyliteral.xml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<d:searchrequest xmlns:d="DAV:" xmlns:oc="http://nextcloud.com/ns">
|
||||
<d:basicsearch>
|
||||
<d:select>
|
||||
<d:prop>
|
||||
<d:displayname/>
|
||||
<d:getcontenttype/>
|
||||
<d:resourcetype/>
|
||||
<d:getcontentlength/>
|
||||
<d:getlastmodified/>
|
||||
<d:creationdate/>
|
||||
<d:getetag/>
|
||||
<d:quota-used-bytes/>
|
||||
<d:quota-available-bytes/>
|
||||
<oc:permissions xmlns:oc="http://owncloud.org/ns"/>
|
||||
<oc:id xmlns:oc="http://owncloud.org/ns"/>
|
||||
<oc:size xmlns:oc="http://owncloud.org/ns"/>
|
||||
<oc:favorite xmlns:oc="http://owncloud.org/ns"/>
|
||||
</d:prop>
|
||||
</d:select>
|
||||
<d:from>
|
||||
<d:scope>
|
||||
<d:href>/files/naofumi</d:href>
|
||||
<d:depth>infinity</d:depth>
|
||||
</d:scope>
|
||||
</d:from>
|
||||
<d:where><d:like><d:prop/><d:literal/></d:like></d:where>
|
||||
<d:orderby/>
|
||||
</d:basicsearch>
|
||||
</d:searchrequest>
|
||||
Loading…
Add table
Add a link
Reference in a new issue