diff options
-rw-r--r-- | mod/attach.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mod/attach.php b/mod/attach.php index d0d3296e1..cf72d09c6 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -24,7 +24,16 @@ function attach_init(&$a) { if(! $c) return; - header('Content-type: ' . $r['data']['filetype']); + + $unsafe_types = array('text/html','text/css','application/javascript'); + + if(in_array($r['data']['filetype'],$unsafe_types)) { + header('Content-type: text/plain'); + } + else { + header('Content-type: ' . $r['data']['filetype']); + } + header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"'); if($r['data']['flags'] & ATTACH_FLAG_OS ) { $istream = fopen('store/' . $c[0]['channel_address'] . '/' . $r['data']['data'],'rb'); |