Skip to content

Commit

Permalink
Use the canonical way of splitting name, version
Browse files Browse the repository at this point in the history
Mozilla website uses rsplit to extract the name and version so it should
be better in any case.
https://github.com/mozilla/bedrock/blob/765a60450235d810cf941676e4a29f012a9eaaba/bedrock/security/models.py#L29
Based on discussion here
mozilla/foundation-security-advisories#76

Signed-off-by: Hritik Vijay <hritikxx8@gmail.com>
  • Loading branch information
Hritik14 committed Mar 26, 2021
1 parent d2505c2 commit 3e2c0f8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vulnerabilities/importers/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ def get_package_urls(self, pkgs: List[str]) -> List[PackageURL]:
package_urls = [
PackageURL(
type="mozilla",
# TODO: Improve after https://github.com/mozilla/foundation-security-advisories/issues/76#issuecomment-803082182
# pkg is of the form "Firefox ESR 1.21" or "Thunderbird 2.21"
name=" ".join(pkg.split(" ")[0:-1]),
version=pkg.split(" ")[-1],
name=pkg.rsplit(None, 1)[0],
version=pkg.rsplit(None, 1)[1],
)
for pkg in pkgs
]
Expand Down

0 comments on commit 3e2c0f8

Please sign in to comment.