Passed
Push — master ( f09347...54a2b1 )
by Luiz Kim
02:32
created
src/Controller/GetFileDataAction.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.