From 5b0d7a40a389beea2ebccf6e1d2809fde0b51334 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 23 Mar 2026 15:46:42 +0100 Subject: [PATCH] `EditNodeForm`: Fix handling of manually changed service node name Previously, a manually changed service node name was always treated as a host node, causing validation to fail with "Host not found" when the input contained a service name, e.g. . Replace unnecessary `getNode()` calls with explicit `createHost()` or `createService()` call. --- application/forms/EditNodeForm.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/forms/EditNodeForm.php b/application/forms/EditNodeForm.php index f2a9e10..7d027b7 100644 --- a/application/forms/EditNodeForm.php +++ b/application/forms/EditNodeForm.php @@ -126,7 +126,12 @@ class EditNodeForm extends CompatForm $node = $this->bp->getNode($nodeName); } elseif ($userInput && (! $nodeLabel || $userInput !== $nodeLabel)) { // User didn't choose a suggestion or changed it manually - $node = $this->bp->getNode(BpConfig::joinNodeName($userInput, 'Hoststatus')); + if ($this->node instanceof ServiceNode) { + [$service, $host] = explode(' on ', $userInput, 2); + $node = $this->bp->createService($host, $service); + } else { + $node = $this->bp->createHost($userInput); + } } else { // If the search and user input are both empty, it can only be the initial value $node = $this->node;