diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e19db642..6c7ed8782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ * Fix for a remote link breaking all CSS rewrites for pipeline * Fix an issue with Retina alternatives not clearing properly between repeat uses * Fix for non standard http/s external markdown links - [#738](https://github.com/getgrav/grav/issues/738) + * Fix for `find()` calling redirects via `dispatch()` causing infinite loops - [#781](https://github.com/getgrav/grav/issues/781) # v1.0.10 ## 02/11/2016 diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 1cb97592d..976ccb16e 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -297,18 +297,20 @@ class Pages */ public function find($url, $all = false) { - return $this->dispatch($url, $all); + return $this->dispatch($url, $all, false); } /** * Dispatch URI to a page. * * @param string $url The relative URL of the page - * @param bool $all + * @param bool $all * + * @param bool $redirect * @return Page|null + * @throws \Exception */ - public function dispatch($url, $all = false) + public function dispatch($url, $all = false, $redirect = true) { // Fetch page if there's a defined route to it. $page = isset($this->routes[$url]) ? $this->get($this->routes[$url]) : null; @@ -324,7 +326,7 @@ class Pages if (!$all && $not_admin && (!$page || ($page && !$page->routable()) || ($page && $page->redirect()))) { // If the page is a simple redirect, just do it. - if ($page && $page->redirect()) { + if ($redirect && $page && $page->redirect()) { $this->grav->redirectLangSafe($page->redirect()); }