Browse Source

Made string removal in root domain detection posix compliant

pull/6178/head
peterv99 3 weeks ago
parent
commit
ab1a2045d9
  1. 8
      dnsapi/dns_mijn_host.sh

8
dnsapi/dns_mijn_host.sh

@ -126,7 +126,7 @@ dns_mijn_host_rm() {
_get_root() { _get_root() {
domain=$1 domain=$1
# Get all domains
# Get all domains
export _H1="API-Key: $MIJN_HOST_API_KEY" export _H1="API-Key: $MIJN_HOST_API_KEY"
export _H2="Content-Type: application/json" export _H2="Content-Type: application/json"
@ -140,17 +140,17 @@ _get_root() {
_err "Error listing domains: $response" _err "Error listing domains: $response"
return 1 return 1
fi fi
# Extract root oomains from response # Extract root oomains from response
rootDomains=$(echo "$response" | jq -r '.data.domains[].domain') rootDomains=$(echo "$response" | jq -r '.data.domains[].domain')
for rootDomain in $rootDomains; do for rootDomain in $rootDomains; do
if _contains "$domain" "$rootDomain"; then if _contains "$domain" "$rootDomain"; then
_domain="$rootDomain" _domain="$rootDomain"
_sub_domain=$(printf '%s\n' "${domain//."$rootDomain"/}")
_sub_domain=$(echo "$domain" | sed "s/$rootDomain//g")
return 0 return 0
fi fi
done done
return 1
return 1
} }
Loading…
Cancel
Save