diff --git a/model/src/main/kotlin/AdvisorRecord.kt b/model/src/main/kotlin/AdvisorRecord.kt index d8b522883224a..d3cb35358fc10 100644 --- a/model/src/main/kotlin/AdvisorRecord.kt +++ b/model/src/main/kotlin/AdvisorRecord.kt @@ -121,8 +121,8 @@ data class AdvisorRecord( } /** - * Merge this list of [Vulnerability] objects by combining vulnerabilities with the same ID and merging their - * references. + * Merge this collection of [Vulnerability] objects by combining vulnerabilities with the same ID and merging their + * references. Other [Vulnerability] properties are taken from the first object which has any such property set. */ private fun Collection.mergeVulnerabilities(): List { val vulnerabilitiesById = groupByTo(sortedMapOf()) { it.id } @@ -130,10 +130,12 @@ private fun Collection.mergeVulnerabilities(): List.mergeReferences(): Vulnerability { val references = flatMapTo(mutableSetOf()) { it.references } - return Vulnerability(id = first().id, references = references.toList()) + val entry = find { it.summary != null || it.description != null } ?: first() + return entry.copy(references = references.toList()) }