Skip to content

Commit 906cfce

Browse files
committed
Don't return a 403 when returning resources for a suspended server; closes pterodactyl#2279
1 parent 6a442c1 commit 906cfce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
99
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
1010
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
11+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1112
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
1213

1314
class AuthenticateServerAccess
@@ -64,8 +65,10 @@ public function handle(Request $request, Closure $next)
6465
}
6566
}
6667

67-
if ($server->suspended) {
68-
throw new AccessDeniedHttpException('This server is currently suspended and the functionality requested is unavailable.');
68+
if ($server->suspended && !$request->routeIs('api:client:server.resources')) {
69+
throw new BadRequestHttpException(
70+
'This server is currently suspended and the functionality requested is unavailable.'
71+
);
6972
}
7073

7174
if (! $server->isInstalled()) {

0 commit comments

Comments
 (0)