Fix active() + activeChild() to work with UTF-8 #1727

This commit is contained in:
Andy Miller
2017-10-31 16:36:13 -06:00
parent 1ca6181856
commit c81ce71074
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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])) {