]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #2377 from wallabag/fix-exists-api
authorThomas Citharel <tcit@tcit.fr>
Wed, 5 Oct 2016 17:52:06 +0000 (19:52 +0200)
committerGitHub <noreply@github.com>
Wed, 5 Oct 2016 17:52:06 +0000 (19:52 +0200)
Fix exists API call

src/Wallabag/ApiBundle/Controller/WallabagRestController.php
tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php

index 791bf80b2310b89e1416289811a07ca879294ccf..a0d9d4f3a144336735468ad3fd4f04b67eda8087 100644 (file)
@@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController
         $url = $request->query->get('url', '');
 
         if (empty($url)) {
-            throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$user->getId());
+            throw $this->createAccessDeniedException('URL is empty?, logged user id: '.$this->getUser()->getId());
         }
 
         $res = $this->getDoctrine()
index fd72b8f2234a31d9769f947ae32e2722cb460ecb..65b65290c2e83731c0e535b11f9ff673fa35406b 100644 (file)
@@ -804,4 +804,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
 
         $this->assertEquals(false, $content['exists']);
     }
+
+    public function testGetEntriesExistsWithNoUrl()
+    {
+        $this->client->request('GET', '/api/entries/exists?url=');
+
+        $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
+    }
 }