Skip to content

Commit 2067ef4

Browse files
committed
Make sure the extracted version starts with a digit
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 028bdb1 commit 2067ef4

File tree

9 files changed

+2
-2954
lines changed

9 files changed

+2
-2954
lines changed

src/fetchcode/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def get_packages_from_listing(purl, source_archive_url, regex, ignored_files_and
670670

671671
version = match.group("version")
672672
version = version.strip("v").strip()
673-
if not version:
673+
if not version or not version[0].isdigit():
674674
continue
675675

676676
modified_time = file.modified

src/fetchcode/package_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _get_github_packages(purl, version_regex, ignored_tag_regex, default_package
127127
version = tag
128128

129129
version = version.strip("Vv").strip()
130-
if not version:
130+
if not version or not version[0].isdigit():
131131
continue
132132

133133
download_url = archive_download_url.format(

tests/data/package/dirlisting/generic/busybox-expected.json

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4642,41 +4642,5 @@
46424642
"repository_homepage_url": null,
46434643
"repository_download_url": null,
46444644
"api_data_url": null
4645-
},
4646-
{
4647-
"type": "generic",
4648-
"namespace": null,
4649-
"name": "busybox",
4650-
"version": "snapshot",
4651-
"qualifiers": {},
4652-
"subpath": null,
4653-
"primary_language": null,
4654-
"description": null,
4655-
"release_date": "2024-03-04T00:20:00",
4656-
"parties": [],
4657-
"keywords": [],
4658-
"homepage_url": "https://www.busybox.net/downloads/",
4659-
"download_url": "https://www.busybox.net/downloads/busybox-snapshot.tar.bz2",
4660-
"api_url": null,
4661-
"size": null,
4662-
"sha1": null,
4663-
"md5": null,
4664-
"sha256": null,
4665-
"sha512": null,
4666-
"bug_tracking_url": null,
4667-
"code_view_url": null,
4668-
"vcs_url": null,
4669-
"copyright": null,
4670-
"license_expression": null,
4671-
"declared_license": null,
4672-
"notice_text": null,
4673-
"root_path": null,
4674-
"dependencies": [],
4675-
"contains_source_code": null,
4676-
"source_packages": [],
4677-
"purl": "pkg:generic/busybox@snapshot",
4678-
"repository_homepage_url": null,
4679-
"repository_download_url": null,
4680-
"api_data_url": null
46814645
}
46824646
]

tests/data/package/dirlisting/generic/bzip2-expected.json

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -322,41 +322,5 @@
322322
"repository_homepage_url": null,
323323
"repository_download_url": null,
324324
"api_data_url": null
325-
},
326-
{
327-
"type": "generic",
328-
"namespace": null,
329-
"name": "bzip2",
330-
"version": "latest",
331-
"qualifiers": {},
332-
"subpath": null,
333-
"primary_language": null,
334-
"description": null,
335-
"release_date": "2019-07-13T17:50:00",
336-
"parties": [],
337-
"keywords": [],
338-
"homepage_url": "https://sourceware.org/pub/bzip2/",
339-
"download_url": "https://sourceware.org/pub/bzip2/bzip2-latest.tar.gz",
340-
"api_url": null,
341-
"size": null,
342-
"sha1": null,
343-
"md5": null,
344-
"sha256": null,
345-
"sha512": null,
346-
"bug_tracking_url": null,
347-
"code_view_url": null,
348-
"vcs_url": null,
349-
"copyright": null,
350-
"license_expression": null,
351-
"declared_license": null,
352-
"notice_text": null,
353-
"root_path": null,
354-
"dependencies": [],
355-
"contains_source_code": null,
356-
"source_packages": [],
357-
"purl": "pkg:generic/bzip2@latest",
358-
"repository_homepage_url": null,
359-
"repository_download_url": null,
360-
"api_data_url": null
361325
}
362326
]

0 commit comments

Comments
 (0)