← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~enriqueesanchz/launchpad:fix-update-cve into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/bugs/scripts/cveimport.py b/lib/lp/bugs/scripts/cveimport.py
> index a1c27d5..e019d07 100644
> --- a/lib/lp/bugs/scripts/cveimport.py
> +++ b/lib/lp/bugs/scripts/cveimport.py
> @@ -723,10 +723,11 @@ class CVEUpdater(LaunchpadCronScript):
>              modified = True
>  
>          # handle affected
> -        metadata = cve.metadata or {}
> -        if metadata.get("affected", {}) != affected:
> -            metadata["affected"] = affected
> -            cve.metadata = metadata
> +        if (
> +            not isinstance(cve.metadata, dict)
> +            or cve.metadata.get("affected", {}) != affected
> +        ):
> +            cve.metadata = {"affected": affected}

What if there were other fields in metadata but not "affected" wouldn't we just update affected? This is probable not an issue now, but it seems odd to overwrite it

Would it be possible to copy the fields from the original value and then update the 'affected' one?

>              modified = True
>  
>          if modified:


-- 
https://code.launchpad.net/~enriqueesanchz/launchpad/+git/launchpad/+merge/494096
Your team Launchpad code reviewers is requested to review the proposed merge of ~enriqueesanchz/launchpad:fix-update-cve into launchpad:master.



References