Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Classes/Routing/Enhancer/ResourceEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,22 @@ public function __construct(array $configuration)
*/
public function enhanceForMatching(RouteCollection $collection): void
{
try {
$basePath = $this->getBasePath();
} catch (\Throwable) {
// The T3api base path cannot be resolved when the current site is not
// determinable, e.g. in CLI sub-requests such as EXT:solr v14 page indexing
// where ServerRequestFactory::fromGlobals() has no valid request URL. The
// API routes are irrelevant for such requests, so skip enhancement instead
// of breaking route matching for the whole request.
return;
}

/** @var Route $variant */
$variant = clone $collection->get('default');
$variant->setPath($this->getBasePath() . sprintf('/{%s?}', self::PARAMETER_NAME));
$variant->setPath($basePath . sprintf('/{%s?}', self::PARAMETER_NAME));
$variant->setRequirement(self::PARAMETER_NAME, '.*');
$collection->add('enhancer_' . $this->getBasePath() . spl_object_hash($variant), $variant);
$collection->add('enhancer_' . $basePath . spl_object_hash($variant), $variant);
}

/**
Expand Down