@@ -67,6 +67,11 @@ public function view_limited_file(UploaderFilesServiceInterface $service, string
6767 "sig " => "application/pgp-signature " ,
6868 "spl " => "application/futuresplash " ,
6969 "doc " => "application/msword " ,
70+ "docx " => "application/vnd.openxmlformats-officedocument.wordprocessingml.document " ,
71+ "xls " => "application/vnd.ms-excel " ,
72+ "xlsx " => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet " ,
73+ "ppt " => "application/vnd.ms-powerpoint " ,
74+ "pptx " => "application/vnd.openxmlformats-officedocument.presentationml.presentation " ,
7075 "ai " => "application/postscript " ,
7176 "torrent " => "application/x-bittorrent " ,
7277 "dvi " => "application/x-dvi " ,
@@ -94,9 +99,16 @@ public function view_limited_file(UploaderFilesServiceInterface $service, string
9499 "asf " => "video/x-ms-asf " ,
95100 "wmv " => "video/x-ms-wmv "
96101 ];
102+
103+ if (isset ($ contentsMaping [$ ext ])) {
104+ $ contentType = $ contentsMaping [$ ext ];
105+ } else {
106+ $ contentType = 'application/octet-stream ' ;
107+ }
108+
97109 $ this ->setResponse (
98110 $ this ->getResponse ()
99- ->withHeader ('Content-type ' , $ contentsMaping [ $ ext ] )
111+ ->withHeader ('Content-Type ' , $ contentType )
100112 ->withBody (new Stream (WWW_ROOT . 'files ' . DS . 'uploads ' . DS . 'limited ' . DS . $ filename ))
101113 );
102114 $ this ->disableAutoRender ();
0 commit comments