@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | ]); |
53 | 53 | $file = $data; |
54 | 54 | //$file = $this->manager->getRepository(File::class)->findOneBy(['url' => $request->getPathInfo()]); |
55 | - if (!$file) |
|
56 | - throw new \Exception('Not found', 404); |
|
55 | + if (!$file) { |
|
56 | + throw new \Exception('Not found', 404); |
|
57 | + } |
|
57 | 58 | |
58 | 59 | |
59 | 60 | $content = $file->getContent(); |
@@ -69,10 +70,11 @@ discard block |
||
69 | 70 | $response->headers->set('Content-Type', "$fileType/$ext"); |
70 | 71 | } |
71 | 72 | |
72 | - if ($fileType == 'image') |
|
73 | - $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo())); |
|
74 | - else |
|
75 | - $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo())); |
|
73 | + if ($fileType == 'image') { |
|
74 | + $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo())); |
|
75 | + } else { |
|
76 | + $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo())); |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $response->headers->set('Content-Disposition', $disposition); |
78 | 80 |