Skip to content

Commit

Permalink
Fixes #768. Retain full name of the jar if there are no versions (#769)
Browse files Browse the repository at this point in the history
* Fixes #768. Retain full name of the jar if there are no versions

Signed-off-by: Prabhu Subramanian <[email protected]>

* Fixes #768. Retain full name of the jar if there are no versions

Signed-off-by: Prabhu Subramanian <[email protected]>

---------

Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Dec 10, 2023
1 parent 17493d4 commit 78731ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "9.9.6",
"version": "9.9.7",
"description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
"homepage": "http://github.com/cyclonedx/cdxgen",
"author": "Prabhu Subramanian <[email protected]>",
Expand Down
12 changes: 6 additions & 6 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6827,17 +6827,17 @@ export const extractJarArchive = function (
if (!name || !version || name === "" || version === "") {
confidence = 0.5;
technique = "filename";
name = jarname.replace(".jar", "");
const tmpA = jarname.split("-");
if (tmpA && tmpA.length > 1) {
const lastPart = tmpA[tmpA.length - 1];
if (!version || version === "") {
version = lastPart.replace(".jar", "");
}
if (!name || name === "") {
// Bug #768. Check if we have any number before simplifying the name.
if (/\d/.test(lastPart)) {
if (!version || version === "") {
version = lastPart.replace(".jar", "");
}
name = jarname.replace("-" + lastPart, "") || "";
}
} else {
name = jarname.replace(".jar", "");
}
}
if (
Expand Down

0 comments on commit 78731ce

Please sign in to comment.