Skip to content

Commit

Permalink
Make sure the extracted version starts with a digit
Browse files Browse the repository at this point in the history
Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Mar 28, 2024
1 parent 028bdb1 commit 2067ef4
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 2,954 deletions.
2 changes: 1 addition & 1 deletion src/fetchcode/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ def get_packages_from_listing(purl, source_archive_url, regex, ignored_files_and

version = match.group("version")
version = version.strip("v").strip()
if not version:
if not version or not version[0].isdigit():
continue

modified_time = file.modified
Expand Down
2 changes: 1 addition & 1 deletion src/fetchcode/package_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _get_github_packages(purl, version_regex, ignored_tag_regex, default_package
version = tag

version = version.strip("Vv").strip()
if not version:
if not version or not version[0].isdigit():
continue

download_url = archive_download_url.format(
Expand Down
36 changes: 0 additions & 36 deletions tests/data/package/dirlisting/generic/busybox-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -4642,41 +4642,5 @@
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": null
},
{
"type": "generic",
"namespace": null,
"name": "busybox",
"version": "snapshot",
"qualifiers": {},
"subpath": null,
"primary_language": null,
"description": null,
"release_date": "2024-03-04T00:20:00",
"parties": [],
"keywords": [],
"homepage_url": "https://www.busybox.net/downloads/",
"download_url": "https://www.busybox.net/downloads/busybox-snapshot.tar.bz2",
"api_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": null,
"vcs_url": null,
"copyright": null,
"license_expression": null,
"declared_license": null,
"notice_text": null,
"root_path": null,
"dependencies": [],
"contains_source_code": null,
"source_packages": [],
"purl": "pkg:generic/busybox@snapshot",
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": null
}
]
36 changes: 0 additions & 36 deletions tests/data/package/dirlisting/generic/bzip2-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,41 +322,5 @@
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": null
},
{
"type": "generic",
"namespace": null,
"name": "bzip2",
"version": "latest",
"qualifiers": {},
"subpath": null,
"primary_language": null,
"description": null,
"release_date": "2019-07-13T17:50:00",
"parties": [],
"keywords": [],
"homepage_url": "https://sourceware.org/pub/bzip2/",
"download_url": "https://sourceware.org/pub/bzip2/bzip2-latest.tar.gz",
"api_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": null,
"vcs_url": null,
"copyright": null,
"license_expression": null,
"declared_license": null,
"notice_text": null,
"root_path": null,
"dependencies": [],
"contains_source_code": null,
"source_packages": [],
"purl": "pkg:generic/bzip2@latest",
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": null
}
]
Loading

0 comments on commit 2067ef4

Please sign in to comment.