From 2ee6bee215565f7413cb12bfea37d1cc0943a6d0 Mon Sep 17 00:00:00 2001 From: chanzihang Date: Wed, 28 Aug 2024 12:23:29 +0800 Subject: [PATCH] =?UTF-8?q?2024-08-28=20=E6=9B=B4=E6=96=B0media-manager?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8F=B4laravel=2011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MediaManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MediaManager.php b/src/MediaManager.php index 392e264..039c0d9 100644 --- a/src/MediaManager.php +++ b/src/MediaManager.php @@ -69,8 +69,9 @@ private function initStorage() $disk = static::config('disk'); $this->storage = Storage::disk($disk); + $isLocal = config('filesystems.disks.' . $disk . '.driver') === 'local'; - if (!$this->storage->getDriver()->getAdapter() instanceof Local) { + if (!$isLocal) { Handler::error('Error', '[laravel-admin-ext/media-manager] only works for local storage.'); } } @@ -103,7 +104,7 @@ public function ls() */ protected function getFullPath($path) { - $fullPath = $this->storage->getDriver()->getAdapter()->applyPathPrefix($path); + $fullPath = $this->storage->path($path); // This handles the prefix if (strstr($fullPath, '..')) { throw new \Exception('Incorrect path'); }