mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Fixed baseURL helper when no app url is set
Also cleaned variable naming to be more obvious
This commit is contained in:
parent
e3230f8f21
commit
038b2418f7
@ -94,12 +94,12 @@ function baseUrl($path, $forceAppDomain = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$path = trim($path, '/');
|
$path = trim($path, '/');
|
||||||
$trimBase = rtrim(config('app.url'), '/');
|
$base = rtrim(config('app.url'), '/');
|
||||||
|
|
||||||
// Remove non-specified domain if forced and we have a domain
|
// Remove non-specified domain if forced and we have a domain
|
||||||
if ($isFullUrl && $forceAppDomain) {
|
if ($isFullUrl && $forceAppDomain) {
|
||||||
if (strpos($path, $trimBase) === 0) {
|
if (!empty($base) && strpos($path, $base) === 0) {
|
||||||
$path = trim(substr($path, strlen($trimBase) - 1));
|
$path = trim(substr($path, strlen($base) - 1));
|
||||||
}
|
}
|
||||||
$explodedPath = explode('/', $path);
|
$explodedPath = explode('/', $path);
|
||||||
$path = implode('/', array_splice($explodedPath, 3));
|
$path = implode('/', array_splice($explodedPath, 3));
|
||||||
@ -110,7 +110,7 @@ function baseUrl($path, $forceAppDomain = false)
|
|||||||
return url($path);
|
return url($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trimBase . '/' . $path;
|
return $base . '/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user