@@ -109,7 +109,8 @@ protected function getFindByUrlQuery(): IQueryBuilder {
109109 ->select ('* ' )
110110 ->from ('bookmarks ' )
111111 ->where ($ qb ->expr ()->eq ('user_id ' , $ qb ->createParameter ('user_id ' )))
112- ->andWhere ($ qb ->expr ()->eq ('url_hash ' , $ qb ->createParameter ('url_hash ' )));
112+ ->andWhere ($ qb ->expr ()->eq ('url_hash ' , $ qb ->createParameter ('url_hash ' )))
113+ ->andWhere ($ qb ->expr ()->eq ('url ' , $ qb ->createParameter ('url ' )));
113114 return $ qb ;
114115 }
115116
@@ -132,7 +133,8 @@ public function findByUrl($userId, $url): Bookmark {
132133 $ qb = $ this ->findByUrlQuery ;
133134 $ qb ->setParameters ([
134135 'user_id ' => $ userId ,
135- 'url_hash ' => md5 ($ url ),
136+ 'url ' => $ url ,
137+ 'url_hash ' => hash ('xxh128 ' , $ url ),
136138 ]);
137139 return $ this ->findEntity ($ qb );
138140 }
@@ -401,7 +403,8 @@ private function _sortAndPaginate(IQueryBuilder $qb, QueryParameters $params): v
401403 private function _filterUrl (IQueryBuilder $ qb , QueryParameters $ params ): void {
402404 if (($ url = $ params ->getUrl ()) !== null ) {
403405 $ normalized = $ this ->urlNormalizer ->normalize ($ url );
404- $ qb ->andWhere ($ qb ->expr ()->eq ('b.url_hash ' , $ qb ->createPositionalParameter (md5 ($ normalized ))));
406+ $ qb ->andWhere ($ qb ->expr ()->eq ('b.url_hash ' , $ qb ->createPositionalParameter (hash ('xxh128 ' , $ normalized ))));
407+ $ qb ->andWhere ($ qb ->expr ()->eq ('b.url ' , $ qb ->createPositionalParameter ($ normalized )));
405408 }
406409 }
407410
@@ -880,7 +883,7 @@ public function insert(Entity $entity): Bookmark {
880883 if ($ entity ->isWebLink ()) {
881884 $ entity ->setUrl ($ this ->urlNormalizer ->normalize ($ entity ->getUrl ()));
882885 }
883- $ entity ->setUrlHash (md5 ( $ entity ->getUrl ()));
886+ $ entity ->setUrlHash (hash ( ' xxh128 ' , $ entity ->getUrl ()));
884887
885888 if ($ entity ->getAdded () === null ) {
886889 $ entity ->setAdded (time ());
0 commit comments