diff --git a/app/Http/Controllers/SkinlibController.php b/app/Http/Controllers/SkinlibController.php index 8a434dc7e..f11ff6157 100644 --- a/app/Http/Controllers/SkinlibController.php +++ b/app/Http/Controllers/SkinlibController.php @@ -221,7 +221,7 @@ public function handleUpload( $size = getimagesize($file); $ratio = $size[0] / $size[1]; if ($type == 'steve' || $type == 'alex') { - if ($ratio != 2 && $ratio != 1) { + if ($ratio != 2 && $ratio != 1 || $type === 'alex' && $ratio === 2) { $message = trans('skinlib.upload.invalid-size', [ 'type' => trans('general.skin'), 'width' => $size[0], diff --git a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php index d1db219bb..2693ec082 100644 --- a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php +++ b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php @@ -321,6 +321,19 @@ public function testHandleUpload() 'name' => 'texture', 'public' => true, 'type' => 'alex', + 'file' => UploadedFile::fake()->image('texture.png', 64, 32), + ])->assertJson([ + 'code' => 1, + 'message' => trans('skinlib.upload.invalid-size', [ + 'type' => trans('general.skin'), + 'width' => 64, + 'height' => 32, + ]), + ]); + $this->postJson(route('texture.upload'), [ + 'name' => 'texture', + 'public' => true, + 'type' => 'steve', 'file' => UploadedFile::fake()->image('texture.png', 100, 50), ])->assertJson([ 'code' => 1,