Skip to content

Commit

Permalink
Throw not found exception on unknown instance (#338)
Browse files Browse the repository at this point in the history
I believe a NotFoundException should be thrown when a instance is not found, instead of a possible PHP error.
  • Loading branch information
bobvandevijver authored and helios-ag committed Nov 1, 2018
1 parent a4bcdab commit 7b11fb1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controller/ElFinderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FM\ElfinderBundle\Event\ElFinderEvents;
use FM\ElfinderBundle\Event\ElFinderPreExecutionEvent;
use FM\ElfinderBundle\Event\ElFinderPostExecutionEvent;
Expand All @@ -32,6 +33,10 @@ class ElFinderController extends Controller
public function showAction(Request $request, $instance, $homeFolder)
{
$efParameters = $this->container->getParameter('fm_elfinder');

if (empty($efParameters['instances'][$instance])) {
throw new NotFoundHttpException('Instance not found');
}
$parameters = $efParameters['instances'][$instance];

if (empty($parameters['locale'])) {
Expand Down

0 comments on commit 7b11fb1

Please sign in to comment.