Skip to content

Commit

Permalink
fix: accumulate SDN comments for merging overflow after all files are…
Browse files Browse the repository at this point in the history
… read
  • Loading branch information
adamdecaf committed Jan 10, 2024
1 parent e48401b commit c092b54
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/server/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ func ofacRecords(logger log.Logger, initialDir string) (*ofac.Results, error) {
}

var res *ofac.Results

for i := range files {
// Does order matter?

if i == 0 {
rr, err := ofac.Read(files[i])
if err != nil {
return nil, fmt.Errorf("read: %v", err)
return nil, fmt.Errorf("reading %s: %v", files[i], err)
}
if rr != nil {
res = rr
res.SDNs = mergeSpilloverRecords(res.SDNs, res.SDNComments)
}
} else {
rr, err := ofac.Read(files[i])
Expand All @@ -185,10 +185,14 @@ func ofacRecords(logger log.Logger, initialDir string) (*ofac.Results, error) {
res.Addresses = append(res.Addresses, rr.Addresses...)
res.AlternateIdentities = append(res.AlternateIdentities, rr.AlternateIdentities...)
res.SDNs = append(res.SDNs, rr.SDNs...)
res.SDNs = mergeSpilloverRecords(res.SDNs, rr.SDNComments)
res.SDNComments = append(res.SDNComments, rr.SDNComments...)
}
}
}

// Merge comments into SDNs
res.SDNs = mergeSpilloverRecords(res.SDNs, res.SDNComments)

return res, err
}

Expand Down

0 comments on commit c092b54

Please sign in to comment.