fix: an empty SITE_URL return a incorrect value of basePath.

This commit is contained in:
KJ 2024-05-09 23:10:58 -04:00
parent c65fcd27c8
commit 186d640c8f

View File

@ -82,7 +82,7 @@ class Router {
*/ */
public static function basePath(): string public static function basePath(): string
{ {
if (defined('SITE_URL')) if (defined('SITE_URL') && !empty(SITE_URL))
return parse_url(SITE_URL, PHP_URL_PATH); return parse_url(SITE_URL, PHP_URL_PATH);
return str_replace($_SERVER['DOCUMENT_ROOT'], '/', ROOT_DIR); return str_replace($_SERVER['DOCUMENT_ROOT'], '/', ROOT_DIR);
} }