@@ -287,18 +287,24 @@ private static function wrapInHttpMessage(string $output, ActionResponse $respon
287287 * @param NodeInterface $node
288288 * @param array $arguments
289289 * @return string The resolved URI for the given node
290+ * @throws \Exception
290291 */
291292 protected function buildNodeUri (NodeInterface $ node , array $ arguments )
292293 {
293294 /** @var Site $currentSite */
294295 $ currentSite = $ node ->getContext ()->getCurrentSite ();
295296 if (!$ currentSite ->hasActiveDomains ()) {
296- throw new \ Exception (" No configured domain! " );
297+ throw new Exception (sprintf ( " Site %s has no active domain" , $ currentSite -> getNodeName ()), 1666684522 );
297298 }
299+ $ primaryDomain = $ currentSite ->getPrimaryDomain ();
300+ if ((string )$ primaryDomain ->getScheme () === '' ) {
301+ throw new Exception (sprintf ("Domain %s for site %s has no scheme defined " , $ primaryDomain ->getHostname (), $ currentSite ->getNodeName ()), 1666684523 );
302+ }
303+
298304 // HINT: We cannot use a static URL here, but instead need to use an URL of the current site.
299305 // This is changed from the the old behavior, where we have changed the LinkingService in LinkingServiceAspect,
300306 // to properly generate the domain part of the routes - and this relies on the proper ControllerContext URI path.
301- $ baseControllerContext = $ this ->buildControllerContextAndSetBaseUri ($ currentSite -> getPrimaryDomain () ->__toString (), $ node , $ arguments );
307+ $ baseControllerContext = $ this ->buildControllerContextAndSetBaseUri ($ primaryDomain ->__toString (), $ node , $ arguments );
302308 $ format = $ arguments ['@format ' ] ?? 'html ' ;
303309 $ uri = $ this ->linkingService ->createNodeUri ($ baseControllerContext , $ node , null , $ format , true , $ arguments , '' , false , [], false );
304310 return $ this ->removeQueryPartFromUri ($ uri );
0 commit comments