Skip to content

Commit

Permalink
TASK: Adapt to Flow base URI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunet committed Sep 6, 2019
1 parent 14347f6 commit 9a1eebc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Classes/Finishers/RedirectFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
*/

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\ServerRequestAttributes;
use Neos\Flow\Http\BaseUriProvider;
use Neos\Flow\Http\Exception as HttpException;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Routing\Exception\MissingActionNameException;
use Neos\Flow\Mvc\Routing\UriBuilder;
Expand Down Expand Up @@ -43,10 +44,18 @@ class RedirectFinisher extends AbstractFinisher
*/
protected $uriFactory;

/**
* @Flow\Inject
* @var BaseUriProvider
*/
protected $baseUriProvider;

/**
* Executes this finisher
*
* @return void
* @throws MissingActionNameException
* @throws HttpException
* @see AbstractFinisher::execute()
*/
public function executeInternal()
Expand All @@ -58,14 +67,14 @@ public function executeInternal()
$statusCode = (int)$this->parseOption('statusCode');
$uri = trim($this->parseOption('uri'));


if ($uri === '') {
$uri = $this->buildActionUri($request);
}

$uriParts = parse_url($uri);
if (!isset($uriParts['scheme']) || $uriParts['scheme'] === '') {
$uri = $request->getHttpRequest()->getAttribute(ServerRequestAttributes::BASE_URI) . $uri;
$uri = $this->baseUriProvider->getConfiguredBaseUriOrFallbackToCurrentRequest() . $uri;
}

$escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
Expand Down

0 comments on commit 9a1eebc

Please sign in to comment.