diff --git a/unifi/unifi.go b/unifi/unifi.go index deb8f72..6663fa9 100644 --- a/unifi/unifi.go +++ b/unifi/unifi.go @@ -212,11 +212,12 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int if err != nil { return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err) } - if strings.Contains(relativeURL, "firewall/zone") { - c.apiPath = c.apiV2Path - } if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() { - reqURL.Path = path.Join(c.apiPath, reqURL.Path) + if strings.Contains(relativeURL, "firewall/zone") { + reqURL.Path = path.Join(c.apiV2Path, reqURL.Path) + } else { + reqURL.Path = path.Join(c.apiPath, reqURL.Path) + } } url := c.baseURL.ResolveReference(reqURL)