Skip to content

Commit 365da62

Browse files
Merge pull request #374 from nextcloud/backport/373/stable16
[stable16] Fall back to application/octet-stream instead of using an invalid mim…
2 parents 96acc83 + d898769 commit 365da62

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/Controller/APIv2.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ protected function getPreview(string $owner, int $fileId, string $filePath): arr
381381
'x' => 150,
382382
'y' => 150,
383383
]);
384-
$preview['mimeType'] = $fileInfo->getMimetype();
384+
$preview['mimeType'] = $fileInfo->getMimetype() ?: 'application/octet-stream';
385385
$preview['isMimeTypeIcon'] = false;
386386
} else {
387-
$preview['source'] = $this->getPreviewPathFromMimeType($fileInfo->getMimetype());
388-
$preview['mimeType'] = $fileInfo->getMimetype();
387+
$preview['mimeType'] = $fileInfo->getMimetype() ?: 'application/octet-stream';
388+
$preview['source'] = $this->getPreviewPathFromMimeType($preview['mimeType']);
389389
}
390390
}
391391

0 commit comments

Comments
 (0)