Skip to content

Commit

Permalink
Merge pull request #427 from crocs-muni/fix/cc-prefer-html-links
Browse files Browse the repository at this point in the history
Prefer links from HTML in CC.
  • Loading branch information
J08nY authored Aug 13, 2024
2 parents 9b30af7 + 31b5c26 commit a14a827
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/sec_certs/sample/cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit a14a827

Please sign in to comment.