From 738b293ea21237152f8e80e9151cab8173f81393 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Tue, 26 Aug 2025 14:53:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E2=80=9C=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=96=87=E4=BB=B6=E5=9C=B0=E5=9D=80=E5=B9=B6=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E6=83=85=E5=86=B5=E8=BD=AC=E6=8D=A2=E4=B8=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=B3=BB=E7=BB=9F=E5=9C=B0=E5=9D=80=E2=80=9Durl?= =?UTF-8?q?=E4=B8=BAnull=E6=83=85=E5=86=B5=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/common.php b/app/common.php index e711188e..3d182061 100644 --- a/app/common.php +++ b/app/common.php @@ -153,8 +153,12 @@ if (!function_exists('get_filesystem_url')) { * @param string $disk 磁盘配置 key * @return string */ - function get_filesystem_url(string $url, string $disk): string + function get_filesystem_url(string|null $url, string $disk): string { + if (is_null($url)) { + return ''; + } + if (\think\helper\Str::startsWith($url, ['http://', 'https://', '//'])) { return $url; } @@ -171,8 +175,12 @@ if (!function_exists('url_filesystem_detect')) { * @param string $url 文件地址 * @return string */ - function url_filesystem_detect(string $url): string + function url_filesystem_detect(string|null $url): string { + if (is_null($url)) { + return ''; + } + $idx = strrpos($url, '.'); if ($idx === false) { return $url;