Detect mimetype by content only with content

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-10-27 10:45:03 +02:00 committed by backportbot[bot]
parent 799b77208e
commit c6cff0ff06

View file

@ -122,7 +122,7 @@ class FileMimeType extends AbstractStringCheck implements IFileCheck {
return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, 'httpd/unix-directory');
}
if ($this->storage->file_exists($this->path)) {
if ($this->storage->file_exists($this->path) && $this->storage->filesize($this->path)) {
$path = $this->storage->getLocalFile($this->path);
$mimeType = $this->mimeTypeDetector->detectContent($path);
return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType);