Skip to content

Commit 54bdedf

Browse files
[6.x] Show proper 404 pages instead of plain text (#13192)
Throw NotFoundHttpException instead of aborting
1 parent 34eb010 commit 54bdedf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Http/Controllers/CP/Assets/BrowserController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Statamic\Contracts\Assets\AssetContainer as AssetContainerContract;
1010
use Statamic\CP\Column;
1111
use Statamic\Exceptions\AuthorizationException;
12+
use Statamic\Exceptions\NotFoundHttpException;
1213
use Statamic\Facades\Asset;
1314
use Statamic\Facades\Scope;
1415
use Statamic\Facades\User;
@@ -54,7 +55,7 @@ public function edit($container, $path)
5455

5556
$asset = Asset::find("{$containerHandle}::{$path}");
5657

57-
abort_unless($container && $asset, 404);
58+
throw_unless($container && $asset, new NotFoundHttpException);
5859

5960
$this->authorize('view', $asset);
6061

src/Http/Controllers/CP/Preferences/Nav/RoleNavController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Statamic\Http\Controllers\CP\Preferences\Nav;
44

55
use Illuminate\Http\Request;
6+
use Statamic\Exceptions\NotFoundHttpException;
67
use Statamic\Facades\CP\Nav;
78
use Statamic\Facades\Preference;
89
use Statamic\Facades\Role;
@@ -23,7 +24,7 @@ protected function ignoreSaveAsOption()
2324

2425
public function edit($handle)
2526
{
26-
abort_unless($role = Role::find($handle), 404);
27+
throw_unless($role = Role::find($handle), new NotFoundHttpException);
2728

2829
$this->currentHandle = $handle;
2930

@@ -43,7 +44,7 @@ public function edit($handle)
4344

4445
public function update(Request $request, $handle)
4546
{
46-
abort_unless($role = Role::find($handle), 404);
47+
throw_unless($role = Role::find($handle), new NotFoundHttpException);
4748

4849
$nav = $this->getUpdatedNav($request);
4950

@@ -58,7 +59,7 @@ public function update(Request $request, $handle)
5859

5960
public function destroy($handle)
6061
{
61-
abort_unless($role = Role::find($handle), 404);
62+
throw_unless($role = Role::find($handle), new NotFoundHttpException);
6263

6364
$role->removePreference('nav')->save();
6465

0 commit comments

Comments
 (0)