. */ declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Illuminate\Contracts\Session\Session; use Illuminate\Http\Request; use Illuminate\Session\Middleware\StartSession; /** * Class StartFireflySession. * */ class StartFireflySession extends StartSession { /** * Store the current URL for the request if necessary. * * @param Request $request * @param Session $session */ protected function storeCurrentUrl(Request $request, $session): void { $url = $request->fullUrl(); $safeUrl = app('steam')->getSafeUrl($url, route('index')); if ($url !== $safeUrl) { return; } if ('GET' === $request->method() && !$request->ajax()) { $session->setPreviousUrl($safeUrl); } } }