Skip to content

Commit 05d93b2

Browse files
committed
Use the canonical way of splitting name, version
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>
1 parent d7ced8b commit 05d93b2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

vulnerabilities/importers/mozilla.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,9 @@ def get_package_urls(self, pkgs: List[str]) -> List[PackageURL]:
130130
package_urls = [
131131
PackageURL(
132132
type="mozilla",
133-
# TODO: Improve after https://github.com/mozilla/foundation-security-advisories/issues/76#issuecomment-803082182
134133
# pkg is of the form "Firefox ESR 1.21" or "Thunderbird 2.21"
135-
name=" ".join(pkg.split(" ")[0:-1]),
136-
version=pkg.split(" ")[-1],
134+
name=pkg.rsplit(None, 1)[0],
135+
version=pkg.rsplit(None, 1)[1],
137136
)
138137
for pkg in pkgs
139138
]

0 commit comments

Comments
 (0)