From 3fef9556e31e93022ef673ef256ab56d29a9ffbd Mon Sep 17 00:00:00 2001 From: MGatner Date: Mon, 7 Oct 2019 09:21:36 -0400 Subject: [PATCH] Bugfix extra autoroute slashes --- system/Router/Router.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/Router/Router.php b/system/Router/Router.php index 843e8427d17c..0b79af581690 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -578,10 +578,9 @@ protected function validateRequest(array $segments): array // Loop through our segments and return as soon as a controller // is found or when such a directory doesn't exist - while ($c -- > 0) + while ($c-- > 0) { - $test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0] - ); + $test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]); if (! is_file(APPPATH . 'Controllers/' . $test . '.php') && $directory_override === false && is_dir(APPPATH . 'Controllers/' . $this->directory . ucfirst($segments[0]))) { @@ -606,6 +605,11 @@ protected function validateRequest(array $segments): array */ protected function setDirectory(string $dir = null, bool $append = false) { + if (empty($dir)) + { + return; + } + $dir = ucfirst($dir); if ($append !== true || empty($this->directory))