Add cache header for image endpoint if link previews

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2022-09-23 12:42:08 +02:00 committed by Vincent Petry (Rebase PR Action)
parent 20b75480d0
commit f4a2ab137b
1 changed files with 4 additions and 2 deletions

View File

@ -59,9 +59,11 @@ class ReferenceController extends Controller {
$appData = $this->appDataFactory->get('core');
$folder = $appData->getFolder('opengraph');
$file = $folder->getFile($referenceId);
return new DataDownloadResponse($file->getContent(), $referenceId, $reference->getImageContentType());
$response = new DataDownloadResponse($file->getContent(), $referenceId, $reference->getImageContentType());
} catch (NotFoundException|NotPermittedException $e) {
return new DataResponse('', Http::STATUS_NOT_FOUND);
$response = new DataResponse('', Http::STATUS_NOT_FOUND);
}
$response->cacheFor(3600, false, true);
return $response;
}
}