Skip to content

Commit

Permalink
Use mapFileAttributes in mimeType
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed May 20, 2024
1 parent 9ec096c commit 86d94c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GridFS/GridFSAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,16 @@ public function mimeType(string $path): FileAttributes
}

$file = $this->findFile($path);

if ($file === null) {
throw UnableToRetrieveMetadata::mimeType($path, 'file does not exist');
}

if ( ! isset($file['metadata'][self::METADATA_MIMETYPE])) {
$attributes = $this->mapFileAttributes($file);
if ($attributes->mimeType() === null) {
throw UnableToRetrieveMetadata::mimeType($path, 'unknown');
}

return new FileAttributes($path, null, null, null, $file['metadata'][self::METADATA_MIMETYPE]);
return $attributes;
}

public function lastModified(string $path): FileAttributes
Expand Down

0 comments on commit 86d94c5

Please sign in to comment.