mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Fixed redirect issue when custom app url in use
Fixes #956 & #1048 Also added tests to cover this url logic. Also removed debugbar during tests to maybe improve test speed.
This commit is contained in:
@ -92,10 +92,15 @@ function baseUrl($path, $forceAppDomain = false)
|
||||
if ($isFullUrl && !$forceAppDomain) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
$path = trim($path, '/');
|
||||
$trimBase = rtrim(config('app.url'), '/');
|
||||
|
||||
// Remove non-specified domain if forced and we have a domain
|
||||
if ($isFullUrl && $forceAppDomain) {
|
||||
if (strpos($path, $trimBase) === 0) {
|
||||
$path = trim(substr($path, strlen($trimBase) - 1));
|
||||
}
|
||||
$explodedPath = explode('/', $path);
|
||||
$path = implode('/', array_splice($explodedPath, 3));
|
||||
}
|
||||
@ -105,7 +110,7 @@ function baseUrl($path, $forceAppDomain = false)
|
||||
return url($path);
|
||||
}
|
||||
|
||||
return rtrim(config('app.url'), '/') . '/' . $path;
|
||||
return $trimBase . '/' . $path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user