Skip to content

Commit f1897c7

Browse files
Allow dashboards with dashes in code to be accessed (#5988)
1 parent c35d96d commit f1897c7

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

modules/backend/classes/BackendController.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,24 @@ public function run($url = null)
8282
$controller = $params[1] ?? 'index';
8383
$isApp = strtolower($module) === 'app';
8484

85-
self::$action = $action = isset($params[2]) ? $this->parseAction($params[2]) : 'index';
86-
self::$params = $controllerParams = array_slice($params, 3);
8785
$controllerClass = "{$module}\\Controllers\\{$controller}";
8886
$controllerBase = $isApp ? base_path() : base_path('modules');
89-
if ($controllerObj = $this->findController(
90-
$controllerClass,
91-
$action,
92-
$controllerBase
93-
)) {
87+
88+
// Try finding the controller first with the original action
89+
$originalAction = $params[2] ?? 'index';
90+
$controllerObj = $this->findController($controllerClass, $originalAction, $controllerBase);
91+
92+
// Use the original action for WildcardController, otherwise transform the action
93+
$action = $originalAction;
94+
if (!($controllerObj instanceof WildcardController)) {
95+
$action = $this->parseAction($originalAction);
96+
$controllerObj = $this->findController($controllerClass, $action, $controllerBase);
97+
}
98+
99+
self::$action = $action;
100+
self::$params = $controllerParams = array_slice($params, 3);
101+
102+
if ($controllerObj) {
94103
if (!$isApp && !System::hasModule(ucfirst($module))) {
95104
return Response::make(View::make('backend::404'), 404);
96105
}

0 commit comments

Comments
 (0)