Skip to content

Commit 406f845

Browse files
committed
updated Router to properly translate uri dashes that map to controller subdirectories. fix issue #4294
1 parent 6e1163f commit 406f845

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

system/Router/Router.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,13 @@ protected function validateRequest(array $segments): array
594594
// is found or when such a directory doesn't exist
595595
while ($c-- > 0)
596596
{
597-
$test = $this->directory . ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]);
597+
$segmentConvert = ucfirst($this->translateURIDashes === true ? str_replace('-', '_', $segments[0]) : $segments[0]);
598+
$test = APPPATH . 'Controllers/' . $this->directory . $segmentConvert;
598599

599-
if (! is_file(APPPATH . 'Controllers/' . $test . '.php') && $directoryOverride === false && is_dir(APPPATH . 'Controllers/' . $this->directory . ucfirst($segments[0])))
600+
if (! is_file($test . '.php') && $directoryOverride === false && is_dir($test))
600601
{
601-
$this->setDirectory(array_shift($segments), true);
602+
$this->setDirectory($segmentConvert, true);
603+
array_shift($segments);
602604
continue;
603605
}
604606

0 commit comments

Comments
 (0)