From c81ce71074f635fac283bb3e5eb03aba6b30f774 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 31 Oct 2017 16:36:13 -0600 Subject: [PATCH] Fix active() + activeChild() to work with UTF-8 #1727 --- CHANGELOG.md | 1 + system/src/Grav/Common/Page/Page.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b586a0caa..df0f124d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Dynamically added pages via `Pages::addPage()` were not firing `onPageProcessed()` event causing forms not to be processed + * Fixed `Page::active()` and `Page::activeChild()` to work with UTF-8 characters in the URL [#1727](https://github.com/getgrav/grav/issues/1727) 1. [](#improved) * Added `Medium::copy()` method to create a copy of a medium object diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 781bccb72..f0720e16f 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2295,7 +2295,7 @@ class Page */ public function active() { - $uri_path = rtrim(Grav::instance()['uri']->path(), '/') ?: '/'; + $uri_path = rtrim(urldecode(Grav::instance()['uri']->path()), '/') ?: '/'; $routes = Grav::instance()['pages']->routes(); if (isset($routes[$uri_path])) { @@ -2318,7 +2318,7 @@ class Page { $uri = Grav::instance()['uri']; $pages = Grav::instance()['pages']; - $uri_path = rtrim($uri->path(), '/'); + $uri_path = rtrim(urldecode($uri->path()), '/'); $routes = Grav::instance()['pages']->routes(); if (isset($routes[$uri_path])) {