Made mimetype check case insensitive.

This commit is contained in:
ADmad 2014-02-17 11:48:00 +05:30
parent 2d10707d18
commit 9ae7f11a2a
2 changed files with 4 additions and 1 deletions

View file

@ -2362,8 +2362,8 @@ class ValidationTest extends CakeTestCase {
$this->assertTrue(Validation::mimeType($image, array('image/gif')));
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), array('image/gif')));
$this->assertTrue(Validation::mimeType(array('tmp_name' => $image), '#image/.+#'));
$this->assertTrue(Validation::mimeType($image, array('image/GIF')));
$this->assertFalse(Validation::mimeType($image, array('image/GIF')));
$this->assertFalse(Validation::mimeType($image, array('image/png')));
$this->assertFalse(Validation::mimeType(array('tmp_name' => $image), array('image/png')));
}

View file

@ -948,6 +948,9 @@ class Validation {
return self::_check($mime, $mimeTypes);
}
foreach ($mimeTypes as $key => $val) {
$mimeTypes[$key] = strtolower($val);
}
return in_array($mime, $mimeTypes);
}