Merge pull request #29454 from nextcloud/bugfix/noid/detect-mimetype-by-content-only-with-content

Detect mimetype by content only with content
This commit is contained in:
blizzz 2021-10-27 14:26:31 +02:00 committed by GitHub
commit 1666bb0790
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,7 +127,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);