Skip to content

Commit

Permalink
Do not append @<version> when rendering CPEs in Affected Components…
Browse files Browse the repository at this point in the history
… view

Also cleanup how ranges are rendered. Previously, ranges with only upper bounds would be rendered as `(|<x.y.z)`, now they're rendered as `(<x.y.z)`.

Fixes #747

Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Feb 24, 2024
1 parent ad83334 commit 1635960
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/views/portfolio/vulnerabilities/VulnerabilityDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1232,20 +1232,22 @@ export default {
affectedComponentLabel: function(affectedComponent) {
let s = affectedComponent.identity;
if (affectedComponent.versionType === 'RANGE') {
s += " ( ";
let rangeParts = [];
if (affectedComponent.versionStartExcluding) {
s += ">" + affectedComponent.versionStartExcluding;
rangeParts.push(`>${affectedComponent.versionStartExcluding}`);
} else if (affectedComponent.versionStartIncluding) {
s += ">=" + affectedComponent.versionStartIncluding;
rangeParts.push(`>=${affectedComponent.versionStartIncluding}`);
}
if (affectedComponent.versionEndExcluding) {
s += "|<" + affectedComponent.versionEndExcluding;
rangeParts.push(`<${affectedComponent.versionEndExcluding}`);
} else if (affectedComponent.versionEndIncluding) {
s += "|<=" + affectedComponent.versionEndIncluding;
rangeParts.push(`<=${affectedComponent.versionEndIncluding}`);
}
s += " )";
} else if (affectedComponent.versionType === 'EXACT' && !s.includes("@")) {
s += "@"+affectedComponent.version;
if (rangeParts.length > 0) {
s += `(${rangeParts.join("|")})`;
}
} else if (affectedComponent.identityType === 'PURL' && affectedComponent.versionType === 'EXACT' && !s.includes("@")) {
s += "@" + affectedComponent.version;
}
return s;
}
Expand Down

0 comments on commit 1635960

Please sign in to comment.