Permalink
Browse files

internal/build: remove IDN disallowed policies if IDN table(s) are pr…

…esent
  • Loading branch information...
ydnar committed Jun 5, 2018
1 parent 20f8983 commit dd6fe14bade3e7d82691f442da3103ba7eb60574
Showing with 14 additions and 4 deletions.
  1. +14 −4 internal/build/zone.go
@@ -51,22 +51,32 @@ func (z *Zone) Normalize() {
func (z *Zone) normalizePolicies() {
// De-dupe
var set = make(map[Policy]struct{}, len(z.Policies))
var hasIDNTable bool
var hasIDNDisallowed bool
for _, p := range z.Policies {
if p.Type == "" {
switch p.Type {
case "":
continue
}
if p.Type == TypeIDNDisallowed {
z.IDNDisallowed = true
case TypeIDNDisallowed:
hasIDNDisallowed = true
case TypeIDNTable:
hasIDNTable = true
}
set[p] = struct{}{}
}
z.Policies = make([]Policy, 0, len(set))
for p := range set {
if p.Type == TypeIDNDisallowed && hasIDNTable {
continue
}
z.Policies = append(z.Policies, p)
}
// Sort
sortPolicies(z.Policies)
// IDN?
z.IDNDisallowed = hasIDNDisallowed && !hasIDNTable
}
func (z *Zone) transition() {

0 comments on commit dd6fe14

Please sign in to comment.