fix message for private textures
doesn't match with HTTP status code
This commit is contained in:
parent
7e4d58d9f0
commit
76a78e187f
|
|
@ -98,7 +98,12 @@ class SkinlibController extends Controller
|
|||
|
||||
if (!$texture->public) {
|
||||
if (!Auth::check() || ($user->uid != $texture->uploader && !$user->isAdmin())) {
|
||||
abort(option('status_code_for_private'), trans('skinlib.show.private'));
|
||||
$statusCode = (int) option('status_code_for_private');
|
||||
if ($statusCode === 404) {
|
||||
abort($statusCode, trans('skinlib.show.deleted'));
|
||||
} else {
|
||||
abort($statusCode, trans('skinlib.show.private'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@
|
|||
- Fixed duplicated route names.
|
||||
- Fixed duplication of private textures.
|
||||
- Fixed that previews and avatars cannot be indivdually cached by image format.
|
||||
- Fixed that message for private textures doesn't match with HTTP status code.
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@
|
|||
- 修复重复的路由命名
|
||||
- 修复私有材质的重复问题
|
||||
- 修复预览图和头像不能根据图像格式来单独缓存的问题
|
||||
- 修复针对私有材质的错误消息不与 HTTP 状态码相符的问题
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ class SkinlibControllerTest extends TestCase
|
|||
option(['status_code_for_private' => 404]);
|
||||
$this->get('/skinlib/show/'.$texture->tid)
|
||||
->assertNotFound()
|
||||
->assertSee(trans('skinlib.show.private'));
|
||||
->assertSee(trans('skinlib.show.deleted'));
|
||||
option(['status_code_for_private' => 403]);
|
||||
|
||||
// Other user should not see private texture
|
||||
$this->actingAs(factory(User::class)->create())
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user