From ce0e9ec31bf6b9d144a2bd7dbd3c912ac59539d6 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 17 Jun 2016 22:18:48 +0200 Subject: Try to find bad redirection after delete Instead of checking for the whole absolute url, we just check with the relative url. If the referer ends with the relative url of the deleted entry, don't redirect to the referer. --- src/Wallabag/CoreBundle/Controller/EntryController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 33b5e2ad..4eb314f7 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -406,7 +406,7 @@ class EntryController extends Controller $url = $this->generateUrl( 'view', ['id' => $entry->getId()], - UrlGeneratorInterface::ABSOLUTE_URL + UrlGeneratorInterface::ABSOLUTE_PATH ); $em = $this->getDoctrine()->getManager(); @@ -418,8 +418,9 @@ class EntryController extends Controller 'flashes.entry.notice.entry_deleted' ); - // don't redirect user to the deleted entry - $to = ($url !== $request->headers->get('referer') ? $request->headers->get('referer') : null); + // don't redirect user to the deleted entry (check that the referer doesn't end with the same url) + $referer = $request->headers->get('referer'); + $to = (1 !== preg_match('#'.$url.'$#i', $referer) ? $referer : null); $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to); -- cgit v1.2.3