aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
Diffstat (limited to 'skate')
-rw-r--r--skate/zippy.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 2317b56..a846a3b 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -354,6 +354,7 @@ func ZippyBrefAugment(bref, raw io.Reader, w io.Writer) error {
// exact match, and twice unmatched).
// TODO: remove duplicates
matched = deduplicateBrefs(matched)
+ matched = removeSelfLinks(matched)
for _, bref := range matched {
stats.total++
if err := enc.Encode(bref); err != nil {
@@ -369,6 +370,18 @@ func ZippyBrefAugment(bref, raw io.Reader, w io.Writer) error {
return err
}
+// removeSelfLinks removes self-referential links. Those should be caught
+// earlier at the root cause later.
+func removeSelfLinks(brefs []*BiblioRef) (result []*BiblioRef) {
+ for _, bref := range brefs {
+ if bref.SourceReleaseIdent == bref.TargetReleaseIdent {
+ continue
+ }
+ result = append(result, bref)
+ }
+ return result
+}
+
// deduplicateBrefs deduplicates by the document id (for elasticsearch), which
// may help filter out some duplicates but not all.
func deduplicateBrefs(brefs []*BiblioRef) []*BiblioRef {