From 2019fb86b780049688863de5aaa7078eba972caa Mon Sep 17 00:00:00 2001 From: WispX Date: Fri, 17 Dec 2021 16:09:48 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Image.php | 2 +- app/Service/UploadService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Image.php b/app/Models/Image.php index 1d008276..40e78037 100644 --- a/app/Models/Image.php +++ b/app/Models/Image.php @@ -78,7 +78,7 @@ class Image extends Model if (! $this->strategy) { return Storage::disk('uploads')->url($this->pathname); } - $domain = Str::replaceFirst('/', '', $this->strategy->configs->get('domain')); + $domain = rtrim($this->strategy->configs->get('domain'), '/'); return $domain.'/'.$this->pathname; } diff --git a/app/Service/UploadService.php b/app/Service/UploadService.php index 01d448bb..d8cc9df9 100644 --- a/app/Service/UploadService.php +++ b/app/Service/UploadService.php @@ -167,7 +167,7 @@ class UploadService protected function getAdapter(int $disk, Collection $configs): AdapterInterface { return match ($disk) { - StrategyKey::Local => new Local($configs->get('root')), + StrategyKey::Local => new Local($configs->get('root') ?: config('filesystems.disks.uploads.root')), StrategyKey::Kodo => new QiniuAdapter( accessKey: $configs->get(KodoOption::AccessKey), secretKey: $configs->get(KodoOption::SecretKey),