From a346b6ee297ea67277d68df14f067301f23ce86c Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 20:28:20 +0200 Subject: [PATCH] Bad redirect when editing a not found transaction. --- app/Exceptions/GracefulNotFoundHandler.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index b5221eca31..ad41f1dbde 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -51,8 +51,8 @@ class GracefulNotFoundHandler extends ExceptionHandler * @param Request $request * @param Exception $exception * - * @throws Exception * @return mixed + * @throws Exception */ public function render($request, Throwable $exception) { @@ -75,7 +75,6 @@ class GracefulNotFoundHandler extends ExceptionHandler return $this->handleAccount($request, $exception); case 'transactions.show': return $this->handleGroup($request, $exception); - break; case 'attachments.show': case 'attachments.edit': // redirect to original attachment holder. @@ -128,19 +127,21 @@ class GracefulNotFoundHandler extends ExceptionHandler case 'transactions.mass.edit': case 'transactions.mass.delete': case 'transactions.bulk.edit': - $request->session()->reflash(); - - return redirect(route('index')); - break; + if ('POST' === $request->method()) { + $request->session()->reflash(); + return redirect(route('index')); + } + return parent::render($request, $exception); } + } /** * @param Request $request * @param Throwable $exception * - * @throws Exception * @return Redirector|Response + * @throws Exception */ private function handleAccount(Request $request, Throwable $exception) { @@ -167,8 +168,8 @@ class GracefulNotFoundHandler extends ExceptionHandler * @param Request $request * @param Throwable $exception * - * @throws Exception * @return RedirectResponse|Redirector|Response + * @throws Exception */ private function handleAttachment(Request $request, Throwable $exception) { @@ -209,11 +210,11 @@ class GracefulNotFoundHandler extends ExceptionHandler } /** - * @param Throwable $request + * @param Throwable $request * @param Exception $exception * - * @throws Exception * @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response + * @throws Exception */ private function handleGroup(Request $request, Throwable $exception) {