Ver Fonte

fix bug in http link without host

Co-Authored-By: Alireza Ahmadi <[email protected]>
MHSanaei há 1 ano atrás
pai
commit
ae55fdc38a
1 ficheiros alterados com 5 adições e 1 exclusões
  1. 5 1
      web/service/sub.go

+ 5 - 1
web/service/sub.go

@@ -590,7 +590,11 @@ func searchHost(headers interface{}) string {
 			switch v.(type) {
 			case []interface{}:
 				hosts, _ := v.([]interface{})
-				return hosts[0].(string)
+				if len(hosts) > 0 {
+					return hosts[0].(string)
+				} else {
+					return ""
+				}
 			case interface{}:
 				return v.(string)
 			}