Skip to content

Commit

Permalink
updated Router to properly translate uri dashes that map to controlle…
Browse files Browse the repository at this point in the history
…r subdirectories. fix issue codeigniter4#4294
  • Loading branch information
sneakyimp committed Mar 6, 2021
1 parent 902320a commit 25c5ecf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,13 @@ protected function validateRequest(array $segments): array
// is found or when such a directory doesn't exist
while ($c-- > 0)
{
$test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]);
$segmentConvert = ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]);
$test = APPPATH . 'Controllers/' . $this->directory . $segmentConvert;

if (! is_file(APPPATH . 'Controllers/' . $test . '.php') && $directoryOverride === false && is_dir(APPPATH . 'Controllers/' . $this->directory . ucfirst($segments[0])))
if (! is_file($test . '.php') && $directoryOverride === false && is_dir($test))
{
$this->setDirectory(array_shift($segments), true);
$this->setDirectory($segmentConvert, true);
array_shift($segments);
continue;
}

Expand Down

0 comments on commit 25c5ecf

Please sign in to comment.