pull/5117/head
alviy 2024-04-27 11:29:30 +03:00 committed by GitHub
parent dbe7cb8dbb
commit dab244ad25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 7 deletions

View File

@ -104,13 +104,12 @@ _get_root() {
domain=$1 domain=$1
i=3 i=3
a="init" a="init"
while [ ! -z $a ] while [ ! -z $a ]; do
do
a=$(printf "%s" "$domain" | cut -d . -f $i-) a=$(printf "%s" "$domain" | cut -d . -f $i-)
i=`expr $i + 1` i=$(($i + 1))
done done
num=`expr $i - 3` n=$(($i - 3))
h=$(printf "%s" "$domain" | cut -d . -f $num-) h=$(printf "%s" "$domain" | cut -d . -f $n-)
if [ -z "$h" ]; then if [ -z "$h" ]; then
#not valid #not valid
_alviy_rest GET "zone/$domain/" _alviy_rest GET "zone/$domain/"
@ -125,8 +124,8 @@ _get_root() {
if _contains "$response" '"code":"NOT_FOUND"'; then if _contains "$response" '"code":"NOT_FOUND"'; then
_debug "$h not found" _debug "$h not found"
else else
s_n=`expr $num - 1` s=$(($n - 1))
_sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s_n) _sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s)
_domain="$h" _domain="$h"
return 0 return 0
fi fi