Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f180e65

Browse files
committed
Removed unnecessary headers and always add "X-Content-Type-Options: nosniff".
1 parent 470d73d commit f180e65

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

server/php/UploadHandler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* jQuery File Upload Plugin PHP Class 6.7
3+
* jQuery File Upload Plugin PHP Class 6.7.1
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -832,14 +832,12 @@ protected function download() {
832832
);
833833
}
834834
$file_path = $this->get_upload_path($file_name, $this->get_version_param());
835+
// Prevent browsers from MIME-sniffing the content-type:
836+
$this->header('X-Content-Type-Options: nosniff');
835837
if (!preg_match($this->options['inline_file_types'], $file_name)) {
836-
$this->header('Content-Description: File Transfer');
837838
$this->header('Content-Type: application/octet-stream');
838839
$this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
839-
$this->header('Content-Transfer-Encoding: binary');
840840
} else {
841-
// Prevent Internet Explorer from MIME-sniffing the content-type:
842-
$this->header('X-Content-Type-Options: nosniff');
843841
$this->header('Content-Type: '.$this->get_file_type($file_path));
844842
$this->header('Content-Disposition: inline; filename="'.$file_name.'"');
845843
}

0 commit comments

Comments
 (0)