Skip to content

允许使用空字符串拼接path路径#138

Open
luoyue712 wants to merge 1 commit intowalkor:masterfrom
luoyue712:patch-2
Open

允许使用空字符串拼接path路径#138
luoyue712 wants to merge 1 commit intowalkor:masterfrom
luoyue712:patch-2

Conversation

@luoyue712
Copy link
Copy Markdown
Contributor

@luoyue712 luoyue712 commented Apr 2, 2026

问题代码:

#[RouteGroup('/system/report')]
class UserController
{
    #[Get('')]
    public function report() { ... }
}

允许空字符串拼接

@walkor
Copy link
Copy Markdown
Owner

walkor commented Apr 3, 2026

#[RouteGroup('/system/report')]
class UserController
{
    #[Get('/')]
    public function report() { ... }
}

从代码含以上看,这个指向 /system/report/ 是合理的。
如果这个pr被合并,那么业务真的需要指向 /system/report/ 时就不好完成。
如果需要指向/system/report ,应该是

#[RouteGroup('/system/report')]
class UserController
{
    #[Get('')]
    public function report() { ... }
}

但是#[Get('')]现在应该不支持

@luoyue712
Copy link
Copy Markdown
Contributor Author

我已修改,并改为使用空字符串拼接

@luoyue712 luoyue712 changed the title 修复路径拼接时末尾多出/问题 允许使用空字符串拼接path路径 Apr 5, 2026
continue;
}
$path = static::normalizeRoutePath($route->path, $controllerClass . '::' . $method->getName());
$fullPath = $prefix ? rtrim($prefix, '/') . $path : $path;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重复的修剪,static::normalizeRoutePrefix已经修剪过了
https://github.com/walkor/webman-framework/blob/master/src/Route.php#L692-L698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants