From: Dan Brown Date: Wed, 13 Apr 2022 11:46:19 +0000 (+0100) Subject: Fixed base URL starting slash usage X-Git-Tag: v22.04~1^2~12^2~1 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/25654b232214583f06aef0a4edfc28815b66b735 Fixed base URL starting slash usage --- diff --git a/app/Http/Request.php b/app/Http/Request.php index 687bae9a6..13892603d 100644 --- a/app/Http/Request.php +++ b/app/Http/Request.php @@ -26,6 +26,7 @@ class Request extends LaravelRequest /** * Override the default request methods to get the base URL * to directly use the custom APP_URL, if set. + * The base URL never ends with a / but should start with one if not empty. * * @return string */ @@ -34,7 +35,7 @@ class Request extends LaravelRequest $appUrl = config('app.url', null); if ($appUrl) { - return rtrim(implode('/', array_slice(explode('/', $appUrl), 3)), '/'); + return '/' . rtrim(implode('/', array_slice(explode('/', $appUrl), 3)), '/'); } return parent::getBaseUrl();