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.
$url = $this->generateUrl(
'view',
['id' => $entry->getId()],
$url = $this->generateUrl(
'view',
['id' => $entry->getId()],
- UrlGeneratorInterface::ABSOLUTE_URL
+ UrlGeneratorInterface::ABSOLUTE_PATH
);
$em = $this->getDoctrine()->getManager();
);
$em = $this->getDoctrine()->getManager();
'flashes.entry.notice.entry_deleted'
);
'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);
$redirectUrl = $this->get('wallabag_core.helper.redirect')->to($to);