]> BookStack Code Mirror - bookstack/commitdiff
Fixed base URL starting slash usage
authorDan Brown <redacted>
Wed, 13 Apr 2022 11:46:19 +0000 (12:46 +0100)
committerDan Brown <redacted>
Wed, 13 Apr 2022 11:46:19 +0000 (12:46 +0100)
app/Http/Request.php

index 687bae9a6cb196e221d9c84ca33f3159da01f2ab..13892603db8768df2f1bcfa012d88bc827e75959 100644 (file)
@@ -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();