@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | try { |
42 | 42 | $file = $data; |
43 | 43 | //$file = $this->manager->getRepository(File::class)->findOneBy(['url' => $request->getPathInfo()]); |
44 | - if (!$file) |
|
45 | - throw new \Exception('Not found', 404); |
|
44 | + if (!$file) { |
|
45 | + throw new \Exception('Not found', 404); |
|
46 | + } |
|
46 | 47 | |
47 | 48 | |
48 | 49 | $content = $file->getContent(); |
@@ -58,10 +59,11 @@ discard block |
||
58 | 59 | $response->headers->set('Content-Type', "$fileType/$ext"); |
59 | 60 | } |
60 | 61 | |
61 | - if ($fileType == 'image') |
|
62 | - $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo())); |
|
63 | - else |
|
64 | - $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo())); |
|
62 | + if ($fileType == 'image') { |
|
63 | + $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo())); |
|
64 | + } else { |
|
65 | + $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo())); |
|
66 | + } |
|
65 | 67 | |
66 | 68 | $response->headers->set('Content-Disposition', $disposition); |
67 | 69 |