Skip to content

Commit

Permalink
Merge pull request #235 from jannydiamond/bugfix/234-broken-usage-urls
Browse files Browse the repository at this point in the history
BUGFIX: Use http request for generating usage urls
  • Loading branch information
Sebobo authored Mar 28, 2024
2 parents e58dc32 + b031c37 commit ba486c8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Classes/Service/UsageDetailsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
use Neos\ContentRepository\Exception\NodeConfigurationException;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Exception as FlowException;
use Neos\Flow\Http\Exception as HttpException;
use Neos\Flow\Http\HttpRequestHandlerInterface;
use Neos\Flow\I18n\Translator;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\Mvc\Routing\Exception\MissingActionNameException;
Expand Down Expand Up @@ -57,6 +59,12 @@ class UsageDetailsService
use CreateContentContextTrait;
use BackendUserTranslationTrait;

/**
* @Flow\Inject
* @var Bootstrap
*/
protected $bootstrap;

/**
* @Flow\Inject
* @var UserService
Expand Down Expand Up @@ -326,7 +334,14 @@ protected function usageIsAccessible(string $workspaceName): bool
*/
protected function buildNodeUri(?Site $site, NodeInterface $node): string
{
$serverRequest = ServerRequest::fromGlobals();
$requestHandler = $this->bootstrap->getActiveRequestHandler();

if ($requestHandler instanceof HttpRequestHandlerInterface) {
$serverRequest = $requestHandler->getHttpRequest();
} else {
$serverRequest = ServerRequest::fromGlobals();
}

$domain = $site ? $site->getPrimaryDomain() : null;

// Build the URI with the correct scheme and hostname for the node in the given site
Expand Down

0 comments on commit ba486c8

Please sign in to comment.