diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index f72b27ede..1d3e496cb 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -557,7 +557,7 @@ class Pages $last_modified = $modified; } - if (Utils::endsWith($name, CONTENT_EXT)) { + if (preg_match('/^[^.].*'.CONTENT_EXT.'$/', $name)) { $page->init($file); $content_exists = true; diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index c4297bc20..2b2da933a 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -74,15 +74,27 @@ class Uri { $config = Grav::instance()['config']; + // resets + $this->paths = []; + $this->params = []; + $this->query = []; + + // get any params and remove them $uri = str_replace($this->root, '', $this->url); - // reset params - $this->params = []; - // process params $uri = $this->processParams($uri, $config->get('system.param_sep')); + // split the URL and params + $bits = parse_url($uri); + + // process query string + if (isset($bits['query'])) { + parse_str($bits['query'], $this->query); + $uri = $bits['path']; + } + // remove the extension if there is one set $parts = pathinfo($uri); @@ -90,25 +102,13 @@ class Uri $this->basename = $parts['basename']; if (preg_match("/\.(".$config->get('system.pages.types').")$/", $parts['basename'])) { - $uri = rtrim($parts['dirname'], '/').'/'.$parts['filename']; + $uri = rtrim(str_replace(DIRECTORY_SEPARATOR, DS, $parts['dirname']), DS). '/' .$parts['filename']; $this->extension = $parts['extension']; } // set the new url $this->url = $this->root . $uri; - - // split into bits - $this->bits = parse_url($uri); - - $this->query = array(); - if (isset($this->bits['query'])) { - parse_str($this->bits['query'], $this->query); - } - - $path = $this->bits['path']; - - $this->paths = array(); - $this->path = $path; + $this->path = $uri; $this->content_path = trim(str_replace($this->base, '', $this->path), '/'); if ($this->content_path != '') { $this->paths = explode('/', $this->content_path);