fix domain store slice retrieval

This commit is contained in:
Alisdair MacLeod
2026-01-27 17:27:16 +00:00
parent 3c5ac17e2f
commit 2c9decfa55
3 changed files with 3 additions and 7 deletions

View File

@@ -61,7 +61,7 @@ func (h *handler) getAllDomains(w http.ResponseWriter, r *http.Request) {
return
}
var ret []api.ReverseProxyDomain
ret := make([]api.ReverseProxyDomain, 0)
for _, d := range domains {
ret = append(ret, domainToApi(d))
}

View File

@@ -6,7 +6,6 @@ import (
"net"
"github.com/netbirdio/netbird/management/server/types"
"github.com/netbirdio/netbird/shared/management/status"
)
type domainType string
@@ -59,10 +58,7 @@ func (m Manager) GetDomains(ctx context.Context, accountID string) ([]*Domain, e
return nil, fmt.Errorf("list free domains: %w", err)
}
domains, err := m.store.ListCustomDomains(ctx, accountID)
if statusErr, ok := status.FromError(err); ok && statusErr.Type() == status.NotFound {
// This is fine, make sure domains are correctly set and continue.
domains = make([]*Domain, 0)
} else if err != nil {
if err != nil {
return nil, fmt.Errorf("list custom domains: %w", err)
}