1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Fixed double path slash URL issue in some cases

- Occurred on system request path usage (Primarily on guest login
  redirection) when a custom path was not in use.
- Added test to cover.

For #3404
This commit is contained in:
Dan Brown
2022-05-04 20:08:22 +01:00
parent 16222de5fa
commit ebc69a8f2c
2 changed files with 17 additions and 1 deletions

View File

@ -34,4 +34,19 @@ class UrlTest extends TestCase
$this->assertEquals('/cool/docs', $bsRequest->getBaseUrl());
$this->assertEquals('https://donkey.example.com:8091/cool/docs/login', $bsRequest->getUri());
}
public function test_app_url_without_path_does_not_duplicate_path_slash()
{
config()->set('app.url', 'https://donkey.example.com');
// Have to manually get and wrap request in our custom type due to testing mechanics
$this->get('/settings');
$bsRequest = Request::createFrom(request());
$this->assertEquals('https://donkey.example.com', $bsRequest->getSchemeAndHttpHost());
$this->assertEquals('', $bsRequest->getBaseUrl());
$this->assertEquals('/settings', $bsRequest->getPathInfo());
$this->assertEquals('https://donkey.example.com/settings', $bsRequest->getUri());
}
}