Skip to content

Commit 01cefbd

Browse files
committed
[reference preview] fix getting null mimetype if the cached reference lacks an image content type
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 710c593 commit 01cefbd

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

core/Controller/ReferenceController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ public function preview(string $referenceId): Response {
5858
$appData = $this->appDataFactory->get('core');
5959
$folder = $appData->getFolder('opengraph');
6060
$file = $folder->getFile($referenceId);
61+
$contentType = $reference === null || $reference->getImageContentType() === null
62+
? $file->getMimeType()
63+
: $reference->getImageContentType();
6164
$response = new DataDownloadResponse(
6265
$file->getContent(),
6366
$referenceId,
64-
$reference === null ? $file->getMimeType() : $reference->getImageContentType()
67+
$contentType
6568
);
6669
} catch (NotFoundException|NotPermittedException $e) {
6770
$response = new DataResponse('', Http::STATUS_NOT_FOUND);

0 commit comments

Comments
 (0)