From c20c9e7998aaeb3a8c55d429bdc258b3aff6b82a Mon Sep 17 00:00:00 2001 From: Frank de Jonge Date: Wed, 25 Sep 2024 19:36:09 +0200 Subject: [PATCH] Fix GridFS implementation. --- src/GridFS/GridFSAdapter.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/GridFS/GridFSAdapter.php b/src/GridFS/GridFSAdapter.php index 382d45759..d5d44a1c6 100644 --- a/src/GridFS/GridFSAdapter.php +++ b/src/GridFS/GridFSAdapter.php @@ -280,17 +280,17 @@ public function lastModified(string $path): FileAttributes public function metadata(string $path, Config $config): StorageAttributes { - $file = $this->findFile($path); - - if ($file !== null) { - return $this->mapFileAttributes($file); - } - if ($this->directoryExists($path)) { return new DirectoryAttributes($path); } - throw UnableToRetrieveMetadata::metadata($path, 'file does not exist'); + $file = $this->findFile($path); + + if ($file === null) { + throw UnableToRetrieveMetadata::metadata($path, 'file does not exist'); + } + + return $this->mapFileAttributes($file); } public function listContents(string $path, bool $deep): iterable