when checking mime types, use the filename.ext from the DB, not the (non-existent) .ext on disk
This commit is contained in:
parent
bbe2b1dc46
commit
06426bdfe6
@ -387,7 +387,7 @@ class Image {
|
|||||||
* @retval string
|
* @retval string
|
||||||
*/
|
*/
|
||||||
public function get_mime_type() {
|
public function get_mime_type() {
|
||||||
return getMimeType($this->get_image_filename());
|
return getMimeType($this->get_image_filename(), $this->get_ext());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -489,7 +489,7 @@ function captcha_check() {
|
|||||||
* @param string &$file File path
|
* @param string &$file File path
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getMimeType($file) {
|
function getMimeType($file, $ext="") {
|
||||||
$type = false;
|
$type = false;
|
||||||
// Fileinfo documentation says fileinfo_open() will use the
|
// Fileinfo documentation says fileinfo_open() will use the
|
||||||
// MAGIC env var for the magic file
|
// MAGIC env var for the magic file
|
||||||
@ -527,7 +527,6 @@ function getMimeType($file) {
|
|||||||
'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
|
'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
|
||||||
'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php'
|
'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php'
|
||||||
);
|
);
|
||||||
$ext = strtolower(pathInfo($file, PATHINFO_EXTENSION));
|
|
||||||
return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream';
|
return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user