Skip to content

Commit

Permalink
Merge pull request #13 from muhammadn/url-bug
Browse files Browse the repository at this point in the history
fixes #12 - should not allow previous local path to be reused in /bac…
  • Loading branch information
denisdulici authored Dec 31, 2018
2 parents a79e2d4 + 293e21e commit 524eb54
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Controllers/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public function back($locale, Request $request)
$session = $request->session();

if (config('language.url')) {
$previous_url = str_replace(env('APP_URL'), '', $session->previousUrl());
$previous_url = substr(str_replace(env('APP_URL'), '', $session->previousUrl()), 7);
if (strlen($previous_url) == 3){
$previous_url = substr($previous_url, 3);
} else {
$previous_url = substr($previous_url, strrpos($previous_url, '/') + 1);
}

$url = rtrim(env('APP_URL'), '/') . '/' . $locale . '/' . ltrim($previous_url, '/');

Expand Down

0 comments on commit 524eb54

Please sign in to comment.