Skip to content

Commit 00a7478

Browse files
authored
Merge pull request #36807 from nextcloud/fix/noid/missing-cached-reference-image-mimetype
Avoid getting null mimetype when getting reference preview
2 parents 5b86ebd + 01cefbd commit 00a7478

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)