fix rendering HttpException with whoops

This commit is contained in:
printempw 2016-08-29 15:10:51 +08:00
parent 1798d07210
commit 9290f1d2a7
4 changed files with 9 additions and 10 deletions

View File

@ -47,6 +47,11 @@ class Handler extends ExceptionHandler
}
if (config('app.debug')) {
foreach ($this->dontReport as $type) {
if ($e instanceof $type) {
return parent::render($request, $e);
}
}
return $this->renderExceptionWithWhoops($e);
}

View File

@ -14,15 +14,9 @@ class CheckPlayerExistMiddleware
preg_match('/\/([^\/]*)\.png/', $request->getUri(), $matches);
}
$player_name = $matches[1];
$player_name = urldecode($matches[1]);
if (\Option::get('allow_chinese_playername')) {
$player_name = urldecode($player_name);
// quick fix of chinese playername route parameter problem
$GLOBALS['player_name'] = $player_name;
}
if (!PlayerModel::where('player_name', $player_name)->count()) {
if (PlayerModel::where('player_name', $player_name)->get()->isEmpty()) {
\Http::abort(404, '角色不存在');
}

View File

@ -118,7 +118,7 @@ Route::group(['middleware' => 'App\Http\Middleware\CheckPlayer
{
// Json profile
Route::get('/{player_name}.json', 'TextureController@json');
Route::get('/{api}/{player_name}.json', 'TextureController@jsonWithApi');
Route::get('/{api}/{player_name}.json', 'TextureController@jsonWithApi')->where('api', 'usm|csl');
// Legacy links
Route::get('/skin/{player_name}.png', 'TextureController@skin');
Route::get('/cape/{player_name}.png', 'TextureController@cape');

View File

@ -5,5 +5,5 @@
@section('content')
<h1>404 Not Found</h1>
<p>详细信息:{{ $message or "Nothing lives here.." }}</p>
<p>详细信息:{{ $message or "这里啥都没有哦" }}</p>
@endsection