reject single-layer alex texture
This commit is contained in:
parent
6f97c1efcc
commit
89bb2b4db9
|
|
@ -221,7 +221,7 @@ class SkinlibController extends Controller
|
|||
$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],
|
||||
|
|
|
|||
|
|
@ -321,6 +321,19 @@ class SkinlibControllerTest extends TestCase
|
|||
'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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user