From 5e2a84b2415ef65066809b4bc0030b6a786c5d5c Mon Sep 17 00:00:00 2001 From: CZECHIA-COM Date: Thu, 26 Feb 2026 16:42:42 +0100 Subject: [PATCH] Update dns_czechia.sh --- dnsapi/dns_czechia.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_czechia.sh b/dnsapi/dns_czechia.sh index 90b1b420..51035e0f 100644 --- a/dnsapi/dns_czechia.sh +++ b/dnsapi/dns_czechia.sh @@ -87,24 +87,30 @@ _czechia_pick_zone() { _debug "Vstupni domena: $_fd_input" _debug "Dostupne zony: $CZ_Zones" + # Musíme použít vstupní parametr _fd_input a převést ho na malé písmena bez tečky na konci _fd=$(echo "$_fd_input" | _lower_case | sed 's/\.$//') _best_zone="" - # Replace comma with space using sed + # Převod čárek na mezery pro bezpečný loop v shellu _zones_space=$(printf "%s" "$CZ_Zones" | sed 's/,/ /g') for _z in $_zones_space; do + # Vyčištění zóny ze seznamu _clean_z=$(echo "$_z" | _lower_case | sed 's/ //g; s/\.$//') [ -z "$_clean_z" ] && continue case "$_fd" in "$_clean_z" | *".$_clean_z") + # Pokud najdeme shodu, uložíme si tu nejdelší (nejpřesnější) zónu if [ ${#_clean_z} -gt ${#_best_zone} ]; then _best_zone="$_clean_z" fi ;; esac - done # Toto done uzavírá 'for' + done # Konec loopu - [ -n "$_best_zone" ] && printf "%s" "$_best_zone" + if [ -n "$_best_zone" ]; then + _debug "Vybrana zona: $_best_zone" + printf "%s" "$_best_zone" + fi }