Skip to content

Commit

Permalink
PopulateFromRaw*() should always call SetLabel3()
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed Jan 14, 2025
1 parent 5bd4854 commit b97251a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 2 additions & 4 deletions models/cloudflare_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ func PopulateFromRawCFSINGLEREDIRECT(rc *RecordConfig, rawfields []string, meta
}

// First rawfield is the label.
if origin != "" { // If we don't know the origin, don't muck with the label.
if err := rc.SetLabel3(rawfields[0], rc.SubDomain, origin); err != nil {
return err
}
if err := rc.SetLabel3(rawfields[0], rc.SubDomain, origin); err != nil {
return err
}

// Parse the remaining fields.
Expand Down
6 changes: 0 additions & 6 deletions models/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ func PopulateFromRawA(rc *RecordConfig, rawfields []string, meta map[string]stri
rc.Type = "A"

// First rawfield is the label.
//if origin != "" { // If we don't know the origin, don't muck with the label.
if err := rc.SetLabel3(rawfields[0], rc.SubDomain, origin); err != nil {
return err
}
//}

// Parse the remaining fields.
rdata, err := ParseA(rawfields[1:], origin)
Expand Down Expand Up @@ -186,11 +184,9 @@ func PopulateFromRawMX(rc *RecordConfig, rawfields []string, meta map[string]str
var err error

// First rawfield is the label.
//if origin != "" { // If we don't know the origin, don't muck with the label.
if err := rc.SetLabel3(rawfields[0], rc.SubDomain, origin); err != nil {
return err
}
//}

// Parse the remaining fields.
rdata, err := ParseMX(rawfields[1:], origin)
Expand Down Expand Up @@ -259,11 +255,9 @@ func PopulateFromRawSRV(rc *RecordConfig, rawfields []string, meta map[string]st
var err error

// First rawfield is the label.
//if origin != "" { // If we don't know the origin, don't muck with the label.
if err := rc.SetLabel3(rawfields[0], rc.SubDomain, origin); err != nil {
return err
}
//}

// Parse the remaining fields.
rdata, err := ParseSRV(rawfields[1:], origin)
Expand Down

0 comments on commit b97251a

Please sign in to comment.