From 31b5c268132994beb277af8ffd21b6cbad3b51da Mon Sep 17 00:00:00 2001 From: J08nY Date: Tue, 13 Aug 2024 11:56:39 +0200 Subject: [PATCH] Prefer links from HTML in CC. --- src/sec_certs/sample/cc.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sec_certs/sample/cc.py b/src/sec_certs/sample/cc.py index 5354ab3b..d4bc73ae 100644 --- a/src/sec_certs/sample/cc.py +++ b/src/sec_certs/sample/cc.py @@ -551,13 +551,12 @@ def merge(self, other: CCCertificate, other_source: str | None = None) -> None: f"Attempting to merge divergent certificates: self[dgst]={self.dgst}, other[dgst]={other.dgst}" ) + # Prefer some values from the HTML + # Links in CSV are currently (13.08.2024) broken. + html_preferred_attrs = {"protection_profiles", "maintenance_updates", "cert_link", "report_link", "st_link"} + for att, val in vars(self).items(): - if ( - (not val) - or (other_source == "html" and att == "protection_profiles") - or (other_source == "html" and att == "maintenance_updates") - or (att == "state") - ): + if (not val) or (other_source == "html" and att in html_preferred_attrs) or (att == "state"): setattr(self, att, getattr(other, att)) else: if getattr(self, att) != getattr(other, att):