Permalink
Browse files

Made mimetype check case insensitive.

  • Loading branch information...
1 parent 2d10707 commit 9ae7f11a2a86c0eb5700da2eeedd66f4f78e3e4a @ADmad ADmad committed Feb 17, 2014
Showing with 4 additions and 1 deletion.
  1. +1 −1 lib/Cake/Test/Case/Utility/ValidationTest.php
  2. +3 −0 lib/Cake/Utility/Validation.php
@@ -2362,8 +2362,8 @@ public function testMimeType() {
$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')));
}
@@ -948,6 +948,9 @@ public static function mimeType($check, $mimeTypes = array()) {
return self::_check($mime, $mimeTypes);
}
+ foreach ($mimeTypes as $key => $val) {
+ $mimeTypes[$key] = strtolower($val);
+ }
return in_array($mime, $mimeTypes);
}

0 comments on commit 9ae7f11

Please sign in to comment.