diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-06-17 22:18:48 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-06-23 09:15:50 +0200 |
commit | 4e411208ccdbbb503ec430ef2b3c748a02abbbcd (patch) | |
tree | 772b20e221b419f1121555a786ce5ac361135d68 /src/Wallabag | |
parent | 11493858a74af2f9b3f9e1fbbddbfffba5813813 (diff) | |
download | wallabag-4e411208ccdbbb503ec430ef2b3c748a02abbbcd.tar.gz wallabag-4e411208ccdbbb503ec430ef2b3c748a02abbbcd.tar.zst wallabag-4e411208ccdbbb503ec430ef2b3c748a02abbbcd.zip |
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.
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 7 |
1 files changed, 4 insertions, 3 deletions
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 | |||
406 | $url = $this->generateUrl( | 406 | $url = $this->generateUrl( |
407 | 'view', | 407 | 'view', |
408 | ['id' => $entry->getId()], | 408 | ['id' => $entry->getId()], |
409 | UrlGeneratorInterface::ABSOLUTE_URL | 409 | UrlGeneratorInterface::ABSOLUTE_PATH |
410 | ); | 410 | ); |
411 | 411 | ||
412 | $em = $this->getDoctrine()->getManager(); | 412 | $em = $this->getDoctrine()->getManager(); |
@@ -418,8 +418,9 @@ class EntryController extends Controller | |||
418 | 'flashes.entry.notice.entry_deleted' | 418 | 'flashes.entry.notice.entry_deleted' |
419 | ); | 419 | ); |
420 | 420 | ||
421 | // don't redirect user to the deleted entry | 421 | // don't redirect user to the deleted entry (check that the referer doesn't end with the same url) |
422 | $to = ($url !== $request->headers->get('referer') ? $request->headers->get('referer') : null); | 422 | $referer = $request->headers->get('referer'); |
423 | $to = (1 !== preg_match('#'.$url.'$#i', $referer) ? $referer : null); | ||
423 | 424 | ||
424 | $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to); | 425 | $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to); |
425 | 426 | ||