mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 02:51:04 +00:00
Merge pull request #3362 from sviande/fix_3361_api_warning
Fix #3361 check type for tags in entry repository
This commit is contained in:
commit
91f9bacf73
3 changed files with 9 additions and 2 deletions
|
@ -102,7 +102,7 @@ class EntryRestController extends WallabagRestController
|
|||
$order = $request->query->get('order', 'desc');
|
||||
$page = (int) $request->query->get('page', 1);
|
||||
$perPage = (int) $request->query->get('perPage', 30);
|
||||
$tags = $request->query->get('tags', '');
|
||||
$tags = is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', '');
|
||||
$since = $request->query->get('since', 0);
|
||||
|
||||
/** @var \Pagerfanta\Pagerfanta $pager */
|
||||
|
|
|
@ -151,7 +151,7 @@ class EntryRepository extends EntityRepository
|
|||
$qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
|
||||
}
|
||||
|
||||
if ('' !== $tags) {
|
||||
if (is_string($tags) && '' !== $tags) {
|
||||
foreach (explode(',', $tags) as $i => $tag) {
|
||||
$entryAlias = 'e' . $i;
|
||||
$tagAlias = 't' . $i;
|
||||
|
|
|
@ -308,6 +308,13 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
$this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
|
||||
}
|
||||
|
||||
public function testGetTaggedEntriesWithBadParams()
|
||||
{
|
||||
$this->client->request('GET', '/api/entries', ['tags' => ['foo', 'bar']]);
|
||||
|
||||
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testGetDatedEntries()
|
||||
{
|
||||
$this->client->request('GET', '/api/entries', ['since' => 1443274283]);
|
||||
|
|
Loading…
Reference in a new issue