Skip to content

Commit

Permalink
Fix: dns api panic on disable dns section (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaling888 authored Jan 18, 2023
1 parent 876653e commit d16727e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hub/route/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ func dnsRouter() http.Handler {
}

func queryDNS(w http.ResponseWriter, r *http.Request) {
if resolver.DefaultResolver == nil {
render.Status(r, http.StatusInternalServerError)
render.JSON(w, r, newError("DNS section is disabled"))
return
}

name := r.URL.Query().Get("name")
qTypeStr, _ := lo.Coalesce(r.URL.Query().Get("type"), "A")

Expand Down

0 comments on commit d16727e

Please sign in to comment.