summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2023-02-22 12:39:26 +0100
committerJulien Veyssier <julien-nc@posteo.net>2023-02-22 12:39:26 +0100
commit01cefbd6d698e97d0c86efc33f6fbd54509528e3 (patch)
treee2ea8d2a73d7ad44fa17b80d2c856bd52b6bce10 /core/Controller
parent710c593d53ab077338ac90d6c73b851d2cc331dc (diff)
downloadnextcloud-server-01cefbd6d698e97d0c86efc33f6fbd54509528e3.tar.gz
nextcloud-server-01cefbd6d698e97d0c86efc33f6fbd54509528e3.zip
[reference preview] fix getting null mimetype if the cached reference lacks an image content type
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'core/Controller')
-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);