Skip to content

Commit 4013847

Browse files
committed
backport laravel / framework #35419
1 parent 8083a9f commit 4013847

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Illuminate/Validation/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ protected function validateActiveUrl($attribute, $value)
12041204
*/
12051205
protected function validateImage($attribute, $value)
12061206
{
1207-
return $this->validateMimes($attribute, $value, array('jpeg', 'png', 'gif', 'bmp'));
1207+
return $this->validateMimes($attribute, $value, array('jpg', 'jpeg', 'png', 'gif', 'bmp'));
12081208
}
12091209

12101210
/**

tests/Validation/ValidationValidatorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,12 @@ public function testValidateImage()
10101010
$file5->expects($this->any())->method('guessExtension')->willReturn('png');
10111011
$v->setFiles(['x' => $file5]);
10121012
$this->assertTrue($v->passes());
1013+
1014+
$file6 = $this->getMock(UploadedFile::class, ['guessExtension', 'getClientOriginalExtension'], $uploadedFile);
1015+
$file6->expects($this->any())->method('guessExtension')->willReturn('jpg');
1016+
$file6->expects($this->any())->method('getClientOriginalExtension')->willReturn('jpg');
1017+
$v->setFiles(['x' => $file6]);
1018+
$this->assertTrue($v->passes());
10131019
}
10141020

10151021

0 commit comments

Comments
 (0)