File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 944
944
$ cache = new Cache (new Filesystem (APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app- ' . $ project ->getId () . DIRECTORY_SEPARATOR . $ bucketId . DIRECTORY_SEPARATOR . $ fileId )); // Limit file number or size
945
945
$ data = $ cache ->load ($ key , 60 * 60 * 24 * 30 * 3 /* 3 months */ );
946
946
947
- $ output = (empty ($ output )) ? ( empty ($ type ) ? 'jpg ' : $ type ) : $ output ;
947
+
948
+ $ contentType = in_array ($ mime , $ outputs ) ? $ mime : $ outputs ['jpg ' ];
949
+
950
+ if (!empty ($ output ) && \array_key_exists ($ output , $ outputs )) {
951
+ $ contentType = $ outputs [$ output ];
952
+ }
953
+
948
954
if ($ data ) {
949
955
return $ response
950
- ->setContentType (( \array_key_exists ( $ output , $ outputs )) ? $ outputs [ $ output ] : $ outputs [ ' jpg ' ] )
956
+ ->setContentType ($ contentType )
951
957
->addHeader ('Expires ' , $ date )
952
958
->addHeader ('X-Appwrite-Cache ' , 'hit ' )
953
959
->send ($ data )
You can’t perform that action at this time.
0 commit comments