aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-02-23 11:04:09 +0100
committerGitHub <noreply@github.com>2023-02-23 11:04:09 +0100
commit00a7478d8df2007697d5caf2e0cb1c298afbb3fd (patch)
tree5cbad6c91f40b23551d51242a0b6db4d9eea8dc3
parent5b86ebd2371d8d72c3b8e342571b4277d08e1743 (diff)
parent01cefbd6d698e97d0c86efc33f6fbd54509528e3 (diff)
downloadnextcloud-server-00a7478d8df2007697d5caf2e0cb1c298afbb3fd.tar.gz
nextcloud-server-00a7478d8df2007697d5caf2e0cb1c298afbb3fd.zip
Merge pull request #36807 from nextcloud/fix/noid/missing-cached-reference-image-mimetype
Avoid getting null mimetype when getting reference preview
-rw-r--r--core/Controller/ReferenceController.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/Controller/ReferenceController.php b/core/Controller/ReferenceController.php
index a892de03e79..ae6aeeaa6cc 100644
--- a/core/Controller/ReferenceController.php
+++ b/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);