Browse Source

优化检测的URL默认值

Karson 1 year ago
parent
commit
d2c275e20a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      application/common.php

+ 5 - 1
application/common.php

@@ -502,13 +502,17 @@ if (!function_exists('check_url_allowed')) {
      * @param string $url URL
      * @return bool
      */
-    function check_url_allowed($url = null)
+    function check_url_allowed($url = '')
     {
         //允许的主机列表
         $allowedHostArr = [
             strtolower(request()->host())
         ];
 
+        if (empty($url)) {
+            return true;
+        }
+
         //如果是站内相对链接则允许
         if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+\$/i", $url) && substr($url, 0, 2) !== '//') {
             return true;