Skip to content

Commit

Permalink
Fixes issues with trimComponents (#613)
Browse files Browse the repository at this point in the history
* fix: trimComponents trims legitimate files

Signed-off-by: BaseCrusher <[email protected]>

* fix: c# sbom generation with versionless packages

Signed-off-by: BaseCrusher <[email protected]>

* chore: fixed linting

Signed-off-by: BaseCrusher <[email protected]>

* revert: c# sbom generation with versionless packages

Signed-off-by: BaseCrusher <[email protected]>

---------

Signed-off-by: BaseCrusher <[email protected]>
Co-authored-by: prabhu <[email protected]>
  • Loading branch information
BaseCrusher and prabhu authored Oct 5, 2023
1 parent 24d39c3 commit bacd100
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4129,13 +4129,16 @@ export const trimComponents = (components, format) => {
const filteredComponents = [];
for (const comp of components) {
if (format === "xml" && comp.component) {
const key = comp.component.purl || comp.component["bom-ref"];
const key =
comp.component.purl ||
comp.component["bom-ref"] ||
comp.name + comp.version;
if (!keyCache[key]) {
keyCache[key] = true;
filteredComponents.push(comp);
}
} else {
const key = comp.purl || comp["bom-ref"];
const key = comp.purl || comp["bom-ref"] || comp.name + comp.version;
if (!keyCache[key]) {
keyCache[key] = true;
filteredComponents.push(comp);
Expand Down

0 comments on commit bacd100

Please sign in to comment.