From ed69aa0cc6a368ab49ea5d1f8b34db6aeee41ea9 Mon Sep 17 00:00:00 2001 From: Ian Bishop Date: Sat, 3 Feb 2018 05:32:18 +1000 Subject: [PATCH] Fix PowerDNS zone URL, add leading slash (#476) --- providers/dns/pdns/pdns.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/providers/dns/pdns/pdns.go b/providers/dns/pdns/pdns.go index a4fd22b0..a7856e6d 100644 --- a/providers/dns/pdns/pdns.go +++ b/providers/dns/pdns/pdns.go @@ -257,12 +257,11 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM if c.host.Path != "/" { path = c.host.Path } - if c.apiVersion > 0 { - if !strings.HasPrefix(uri, "api/v") { - uri = "/api/v" + strconv.Itoa(c.apiVersion) + uri - } else { - uri = "/" + uri - } + if !strings.HasPrefix(uri, "/") { + uri = "/" + uri + } + if c.apiVersion > 0 && !strings.HasPrefix(uri, "/api/v") { + uri = "/api/v" + strconv.Itoa(c.apiVersion) + uri } url := c.host.Scheme + "://" + c.host.Host + path + uri req, err := http.NewRequest(method, url, body)