Merge pull request #36807 from nextcloud/fix/noid/missing-cached-reference-image-mimetype

Avoid getting null mimetype when getting reference preview
pull/36834/head
Julius Härtl 1 year ago committed by GitHub
commit 00a7478d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,10 +58,13 @@ class ReferenceController extends Controller {
$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);

Loading…
Cancel
Save