]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Request.php
Updated attachment links to have dropdown for open type
[bookstack] / app / Http / Request.php
index 687bae9a6cb196e221d9c84ca33f3159da01f2ab..4cbdf34bae6ac266463776d9e825be5128abdc9c 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,9 @@ class Request extends LaravelRequest
         $appUrl = config('app.url', null);
 
         if ($appUrl) {
-            return rtrim(implode('/', array_slice(explode('/', $appUrl), 3)), '/');
+            $parsedBaseUrl = rtrim(implode('/', array_slice(explode('/', $appUrl), 3)), '/');
+
+            return empty($parsedBaseUrl) ? '' : ('/' . $parsedBaseUrl);
         }
 
         return parent::getBaseUrl();