优化站内相对链接判断

优化后台链接跳转
pull/446/head
Karson 2023-06-20 16:46:04 +08:00
parent 7e6314a701
commit 4eaae6ac4e
2 changed files with 3 additions and 2 deletions

View File

@ -66,7 +66,8 @@ class Index extends Backend
*/ */
public function login() public function login()
{ {
$url = $this->request->get('url', 'index/index', 'url_clean'); $url = $this->request->get('url', '', 'url_clean');
$url = $url ?: 'index/index';
if ($this->auth->isLogin()) { if ($this->auth->isLogin()) {
$this->success(__("You've logged in, do not login again"), $url); $this->success(__("You've logged in, do not login again"), $url);
} }

View File

@ -514,7 +514,7 @@ if (!function_exists('check_url_allowed')) {
} }
//如果是站内相对链接则允许 //如果是站内相对链接则允许
if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+\$/i", $url) && substr($url, 0, 2) !== '//') { if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+((\?|#).*)?\$/i", $url) && substr($url, 0, 2) !== '//') {
return true; return true;
} }