Skip to content

Commit

Permalink
Merge pull request #5 from hfig/master
Browse files Browse the repository at this point in the history
Don't read entire file into memory to determine its mime type
  • Loading branch information
robgridley authored Sep 23, 2019
2 parents 91927ce + ecdc83b commit 2baf554
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SmbAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,14 @@ public function getSize($path)
*/
public function getMimetype($path)
{
$metadata = $this->read($path);
$metadata = $this->readStream($path);

if ($metadata === false) {
return false;
}

$metadata['mimetype'] = Util::guessMimeType($path, $metadata['contents']);
$metadata['mimetype'] = Util::guessMimeType($path, stream_get_contents($metadata['stream'], 65536));
rewind($metadata['stream']);

return $metadata;
}
Expand Down

0 comments on commit 2baf554

Please sign in to comment.