mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
[reference preview] fix getting null mimetype if the cached reference lacks an image content type
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
710c593d53
commit
01cefbd6d6
1 changed files with 4 additions and 1 deletions
|
|
@ -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…
Reference in a new issue