Browse Source
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
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
1 deletions
-
core/Controller/ReferenceController.php
|
|
|
@ -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); |
|
|
|
|