From 07e303bcc13670ff024e2276c24d5f5d6e1e5cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Tue, 15 Jul 2025 13:36:44 +0200 Subject: [PATCH] Remove anything behind .local and ignore case --- wled00/mqtt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wled00/mqtt.cpp b/wled00/mqtt.cpp index 06247ac58..01773d9fd 100644 --- a/wled00/mqtt.cpp +++ b/wled00/mqtt.cpp @@ -215,7 +215,9 @@ bool initMqtt() } else { #ifdef ARDUINO_ARCH_ESP32 String mqttMDNS = mqttServer; - mqttMDNS.replace(F(".local"), ""); // remove .local if present + mqttMDNS.toLowerCase(); // make sure we have a lowercase hostname + int pos = mqttMDNS.indexOf(F(".local")); + if (pos > 0) mqttMDNS.remove(pos); // remove .local domain if present (and anything following it) if (strlen(cmDNS) > 0 && mqttMDNS.length() > 0 && mqttMDNS.indexOf('.') < 0) { // if mDNS is enabled and server does not have domain mqttIP = MDNS.queryHost(mqttMDNS.c_str()); if (mqttIP != IPAddress()) // if MDNS resolved the hostname