aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-28 14:18:33 +0200
committerGitHub <noreply@github.com>2019-05-28 14:18:33 +0200
commit2cbee36a0184786644470a84fdd8c720cfcac58e (patch)
tree33c6040c050f85c537f8dbf5e91d8c281db092cd /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parent48d136d3a08d7f4ca8e0d434d8104c746d31957d (diff)
parent629a3797bcef33943df8ef5631328e05d12634ed (diff)
downloadwallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.tar.gz
wallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.tar.zst
wallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.zip
Merge pull request #3944 from shtrom/always-hash-exists-url
Always hash exists url
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 3990932e..880e7c65 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -9,6 +9,7 @@ use Pagerfanta\Adapter\DoctrineORMAdapter;
9use Pagerfanta\Pagerfanta; 9use Pagerfanta\Pagerfanta;
10use Wallabag\CoreBundle\Entity\Entry; 10use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\CoreBundle\Entity\Tag; 11use Wallabag\CoreBundle\Entity\Tag;
12use Wallabag\CoreBundle\Helper\UrlHasher;
12 13
13class EntryRepository extends EntityRepository 14class EntryRepository extends EntityRepository
14{ 15{
@@ -348,17 +349,10 @@ class EntryRepository extends EntityRepository
348 */ 349 */
349 public function findByUrlAndUserId($url, $userId) 350 public function findByUrlAndUserId($url, $userId)
350 { 351 {
351 $res = $this->createQueryBuilder('e') 352 return $this->findByHashedUrlAndUserId(
352 ->where('e.url = :url')->setParameter('url', urldecode($url)) 353 UrlHasher::hashUrl($url),
353 ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) 354 $userId
354 ->getQuery() 355 );
355 ->getResult();
356
357 if (\count($res)) {
358 return current($res);
359 }
360
361 return false;
362 } 356 }
363 357
364 /** 358 /**