diff options
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 3990932e..960b682d 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -348,17 +348,9 @@ class EntryRepository extends EntityRepository | |||
348 | */ | 348 | */ |
349 | public function findByUrlAndUserId($url, $userId) | 349 | public function findByUrlAndUserId($url, $userId) |
350 | { | 350 | { |
351 | $res = $this->createQueryBuilder('e') | 351 | return $this->findByHashedUrlAndUserId( |
352 | ->where('e.url = :url')->setParameter('url', urldecode($url)) | 352 | hash('sha1', $url), // XXX: the hash logic would better be in a separate util to avoid duplication with GenerateUrlHashesCommand::generateHashedUrls |
353 | ->andWhere('e.user = :user_id')->setParameter('user_id', $userId) | 353 | $userId); |
354 | ->getQuery() | ||
355 | ->getResult(); | ||
356 | |||
357 | if (\count($res)) { | ||
358 | return current($res); | ||
359 | } | ||
360 | |||
361 | return false; | ||
362 | } | 354 | } |
363 | 355 | ||
364 | /** | 356 | /** |