Skip to content

Commit

Permalink
Fix EZP-23505: Router generates wrong URL without vhost
Browse files Browse the repository at this point in the history
  • Loading branch information
blankse committed Oct 23, 2014
1 parent d2b2f55 commit 8d6dc7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion eZ/Publish/Core/MVC/Symfony/Routing/Generator.php
Expand Up @@ -103,14 +103,16 @@ public function generate( $urlResource, array $parameters, $absolute = false )
}
}

$url = $requestContext->getBaseUrl() . $this->doGenerate( $urlResource, $parameters );
$url = $this->doGenerate( $urlResource, $parameters );

// Add the SiteAccess URI back if needed.
if ( $siteAccess && $siteAccess->matcher instanceof SiteAccess\URILexer )
{
$url = $siteAccess->matcher->analyseLink( $url );
}

$url = $requestContext->getBaseUrl() . $url;

if ( $absolute )
{
$url = $this->generateAbsoluteUrl( $url, $requestContext );
Expand Down
8 changes: 4 additions & 4 deletions eZ/Publish/Core/MVC/Symfony/Routing/Tests/GeneratorTest.php
Expand Up @@ -79,8 +79,8 @@ public function testSimpleGenerate( $urlResource, array $parameters, $absolute )
$matcher
->expects( $this->once() )
->method( 'analyseLink' )
->with( $fullUri )
->will( $this->returnValue( $fullUri ) );
->with( $uri )
->will( $this->returnValue( $uri ) );

if ( $absolute )
{
Expand Down Expand Up @@ -113,8 +113,8 @@ public function testGenerateWithSiteAccessNoReverseMatch( $urlResource, array $p
$matcher
->expects( $this->once() )
->method( 'analyseLink' )
->with( $fullUri )
->will( $this->returnValue( $fullUri ) );
->with( $uri )
->will( $this->returnValue( $uri ) );

if ( $absolute )
{
Expand Down

0 comments on commit 8d6dc7c

Please sign in to comment.