summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-07-20 17:19:59 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-07-20 17:19:59 -0100
commit2f5449580570b14cf181c24b8cd3dbd978666b91 (patch)
tree2280f3b3eaa3ad8c28bef617ae518322f9558391 /lib/Controller
parenteadc04fc6165ddf2f12261f5916a6b52f7467804 (diff)
send header on documentGet
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/LocalController.php5
-rw-r--r--lib/Controller/NavigationController.php22
2 files changed, 17 insertions, 10 deletions
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index 9b91131c..e003ff84 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -701,9 +701,10 @@ class LocalController extends Controller {
$actor = $this->cacheActorService->getFromId($id);
if ($actor->gotIcon()) {
$avatar = $actor->getIcon();
- $document = $this->documentService->getFromCache($avatar->getId());
+ $document = $this->documentService->getFromCache($avatar->getId(), $mime);
- $response = new FileDisplayResponse($document);
+ $response =
+ new FileDisplayResponse($document, Http::STATUS_OK, ['Content-Type' => $mime]);
$response->cacheFor(86400);
return $response;
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php
index b9b256a0..b613fb1e 100644
--- a/lib/Controller/NavigationController.php
+++ b/lib/Controller/NavigationController.php
@@ -291,9 +291,11 @@ class NavigationController extends Controller {
*/
public function documentGet(string $id): Response {
try {
- $file = $this->documentService->getFromCache($id);
+ $mime = '';
+ $file = $this->documentService->getFromCache($id, $mime);
+
+ return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
- return new FileDisplayResponse($file, Http::STATUS_OK);
} catch (Exception $e) {
return $this->fail($e);
}
@@ -311,9 +313,10 @@ class NavigationController extends Controller {
public function documentGetPublic(string $id): Response {
try {
- $file = $this->documentService->getFromCache($id, true);
+ $mime = '';
+ $file = $this->documentService->getFromCache($id, $mime, true);
- return new FileDisplayResponse($file);
+ return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
} catch (Exception $e) {
return $this->fail($e);
}
@@ -331,9 +334,10 @@ class NavigationController extends Controller {
public function resizedGet(string $id): Response {
try {
- $file = $this->documentService->getResizedFromCache($id);
+ $mime = '';
+ $file = $this->documentService->getResizedFromCache($id, $mime);
- return new FileDisplayResponse($file);
+ return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
} catch (Exception $e) {
return $this->fail($e);
}
@@ -351,12 +355,14 @@ class NavigationController extends Controller {
public function resizedGetPublic(string $id): Response {
try {
- $file = $this->documentService->getResizedFromCache($id, true);
+ $mime = '';
+ $file = $this->documentService->getResizedFromCache($id, $mime, true);
- return new FileDisplayResponse($file);
+ return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]);
} catch (Exception $e) {
return $this->fail($e);
}
}
}
+