Skip to content

Commit

Permalink
Use Request::getBaseUrl()
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Jul 24, 2020
1 parent 8f44044 commit 0c321e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core-bundle/src/Controller/BackendPreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ public function __invoke(Request $request): Response
return new RedirectResponse($targetUrl);
}

return new RedirectResponse($this->previewScript ?: '/');
return new RedirectResponse($request->getBaseUrl().'/');
}
}
6 changes: 3 additions & 3 deletions core-bundle/tests/Controller/BackendPreviewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testDispatchesPreviewUrlConvertEvent(): void
public function testRedirectsToRootPage(): void
{
$controller = new BackendPreviewController(
'',
'/',
$this->createMock(FrontendPreviewAuthenticator::class),
new EventDispatcher(),
$this->mockAuthorizationChecker()
Expand All @@ -121,7 +121,7 @@ public function testRedirectsToRootPage(): void
public function testRedirectsToRootPageWitPreviewScript(): void
{
$controller = new BackendPreviewController(
'preview.php',
'preview.php/',
$this->createMock(FrontendPreviewAuthenticator::class),
new EventDispatcher(),
$this->mockAuthorizationChecker()
Expand All @@ -131,7 +131,7 @@ public function testRedirectsToRootPageWitPreviewScript(): void
$response = $controller($this->mockRequest());

$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertSame('preview.php', $response->getTargetUrl());
$this->assertSame('preview.php/', $response->getTargetUrl());
}

/**
Expand Down

0 comments on commit 0c321e4

Please sign in to comment.