Skip to content

Commit

Permalink
Merge pull request #36807 from nextcloud/fix/noid/missing-cached-refe…
Browse files Browse the repository at this point in the history
…rence-image-mimetype

Avoid getting null mimetype when getting reference preview
  • Loading branch information
juliusknorr authored Feb 23, 2023
2 parents 5b86ebd + 01cefbd commit 00a7478
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/Controller/ReferenceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ public function preview(string $referenceId): Response {
$appData = $this->appDataFactory->get('core');
$folder = $appData->getFolder('opengraph');
$file = $folder->getFile($referenceId);
$contentType = $reference === null || $reference->getImageContentType() === null
? $file->getMimeType()
: $reference->getImageContentType();
$response = new DataDownloadResponse(
$file->getContent(),
$referenceId,
$reference === null ? $file->getMimeType() : $reference->getImageContentType()
$contentType
);
} catch (NotFoundException|NotPermittedException $e) {
$response = new DataResponse('', Http::STATUS_NOT_FOUND);
Expand Down

0 comments on commit 00a7478

Please sign in to comment.