mirror of
https://github.com/wallabag/wallabag.git
synced 2025-02-20 04:26:16 +00:00
Merge pull request #2156 from wallabag/delete-redirect
Try to find bad redirection after delete
This commit is contained in:
commit
3c552f0d04
1 changed files with 4 additions and 3 deletions
|
@ -406,7 +406,7 @@ class EntryController extends Controller
|
||||||
$url = $this->generateUrl(
|
$url = $this->generateUrl(
|
||||||
'view',
|
'view',
|
||||||
['id' => $entry->getId()],
|
['id' => $entry->getId()],
|
||||||
UrlGeneratorInterface::ABSOLUTE_URL
|
UrlGeneratorInterface::ABSOLUTE_PATH
|
||||||
);
|
);
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
@ -418,8 +418,9 @@ class EntryController extends Controller
|
||||||
'flashes.entry.notice.entry_deleted'
|
'flashes.entry.notice.entry_deleted'
|
||||||
);
|
);
|
||||||
|
|
||||||
// don't redirect user to the deleted entry
|
// don't redirect user to the deleted entry (check that the referer doesn't end with the same url)
|
||||||
$to = ($url !== $request->headers->get('referer') ? $request->headers->get('referer') : null);
|
$referer = $request->headers->get('referer');
|
||||||
|
$to = (1 !== preg_match('#'.$url.'$#i', $referer) ? $referer : null);
|
||||||
|
|
||||||
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to);
|
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue