Skip to content

Firefly III: a personal finances manager

Refer to steam method

James Cole5d71baa4a18e
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index ba68632bd0..9b52ef9dc6 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -202,7 +202,7 @@ class Handler extends ExceptionHandler
protected function invalid($request, LaravelValidationException $exception): Application|RedirectResponse|Redirector
{
// protect against open redirect when submitting invalid forms.
- $previous = $this->getPreviousUrl();
+ $previous = app('steam')->getSafePreviousUrl();
$redirect = $this->getRedirectUrl($exception);
return redirect($redirect ?? $previous)
@@ -210,21 +210,6 @@ class Handler extends ExceptionHandler
->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag));
}
- /**
- * Only return the previousUrl() if it is a valid URL. Return default redirect otherwise.
- *
- * @return string
- */
- private function getPreviousUrl(): string
- {
- $safe = route('index');
- $previous = url()->previous();
- $previousHost = parse_url($previous, PHP_URL_HOST);
- $safeHost = parse_url($safe, PHP_URL_HOST);
-
- return null !== $previousHost && $previousHost === $safeHost ? $previous : $safe;
- }
-
/**
* Only return the redirectTo property from the exception if it is a valid URL. Return NULL otherwise.
*