From e4d40af5ec375a19234d8cf3a1453aa470c81fe4 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 30 Jun 2020 20:26:01 +0900 Subject: [PATCH 1/2] Add missing end marker to router regexp --- common/framework/router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/framework/router.php b/common/framework/router.php index 75bb2e1ac..0012f5570 100644 --- a/common/framework/router.php +++ b/common/framework/router.php @@ -137,7 +137,7 @@ class Router } // Try to detect the prefix. This might be $mid. - if ($rewrite_level >= 2 && preg_match('#^([a-zA-Z0-9_-]+)(?:/(.*))?#s', $url, $matches)) + if ($rewrite_level >= 2 && preg_match('#^([a-zA-Z0-9_-]+)(?:/(.*))?$#s', $url, $matches)) { // Separate the prefix and the internal part of the URL. $prefix = $matches[1]; From 6e6aa6401de74dab875cee8bd74cd76be0646468 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 1 Jul 2020 15:17:19 +0900 Subject: [PATCH 2/2] Detect the index action in Router --- common/framework/router.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/framework/router.php b/common/framework/router.php index 0012f5570..ba62ab78d 100644 --- a/common/framework/router.php +++ b/common/framework/router.php @@ -159,6 +159,16 @@ class Router // If a module is found, try its routes. if ($action_info) { + // Try the index action. + if ($internal_url === '' && !isset($args['act']) && $action_info->default_index_act) + { + $allargs = array_merge($args, [$prefix_type => $prefix]); + $result->module = $module_name; + $result->mid = $prefix_type === 'mid' ? $prefix : ''; + $result->args = $allargs; + return $result; + } + // Try the list of routes defined by the module. foreach ($action_info->route->{$method} as $regexp => $action) {