X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Ffront%2Fcontroller%2Fvisitor%2FShaarliVisitorController.php;h=55c075a2a87f7ae8c7cad95c5134bf78c53e3cf5;hb=4a26974a4b36362d25d8a3a029eac539685c03f6;hp=cd27455bbf8d8810054e469fd564f89804c4c959;hpb=949a0953109c2738ecd973c44cd728cddc120164;p=github%2Fshaarli%2FShaarli.git diff --git a/application/front/controller/visitor/ShaarliVisitorController.php b/application/front/controller/visitor/ShaarliVisitorController.php index cd27455b..55c075a2 100644 --- a/application/front/controller/visitor/ShaarliVisitorController.php +++ b/application/front/controller/visitor/ShaarliVisitorController.php @@ -142,6 +142,13 @@ abstract class ShaarliVisitorController if (null !== $referer) { $currentUrl = parse_url($referer); + // If the referer is not related to Shaarli instance, redirect to default + if (isset($currentUrl['host']) + && strpos(index_url($this->container->environment), $currentUrl['host']) === false + ) { + return $response->withRedirect($defaultPath); + } + parse_str($currentUrl['query'] ?? '', $params); $path = $currentUrl['path'] ?? $defaultPath; } else {