Skip to content

Commit

Permalink
Merge pull request #2308 from MGatner/autoroute-slashes
Browse files Browse the repository at this point in the history
Bugfix extra autoroute slashes
  • Loading branch information
lonnieezell authored Oct 8, 2019
2 parents 5295d37 + 3fef955 commit c2407a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])))
{
Expand All @@ -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))
Expand Down

0 comments on commit c2407a1

Please sign in to comment.