From 9924eaf1ecee02e5235b4c4643b4438286414ab5 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Wed, 29 Jan 2025 14:39:48 +0100 Subject: [PATCH] fix: fix issue with setting external references (in `bom granularity`) --- ChangeLog.md | 3 ++- capycli/common/capycli_bom_support.py | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 2d5b3aa..0ff0c55 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -18,7 +18,8 @@ to SPECIFIC of to the value given by `-pms`. Now **existing** Project Mainline States are kept. * `project create` has a new parameter `--copy_from` which allows to first create a copy of the given project and then update the releases based on the contents of the given SBOM. -* fix for `bom map` losing SBOM items when it tries to map to invalid SW360 releases +* fix for `bom map` losing SBOM items when it tries to map to invalid SW360 releases. +* fix issue with setting external references (in `bom granularity`). ## 2.6.0 diff --git a/capycli/common/capycli_bom_support.py b/capycli/common/capycli_bom_support.py index 4c60b68..ea3c1e8 100644 --- a/capycli/common/capycli_bom_support.py +++ b/capycli/common/capycli_bom_support.py @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------- -# Copyright (c) 2023-2024 Siemens +# Copyright (c) 2023-2025 Siemens # All Rights Reserved. # Author: thomas.graf@siemens.com # @@ -124,10 +124,16 @@ def get_ext_ref(comp: Component, type: ExternalReferenceType, comment: str) -> O @staticmethod def set_ext_ref(comp: Component, type: ExternalReferenceType, comment: str, value: str, hash_algo: str = "", hash: str = "") -> None: - ext_ref = ExternalReference( - type=type, - url=XsUri(value), - comment=comment) + if isinstance(value, XsUri): + ext_ref = ExternalReference( + type=type, + url=value, + comment=comment) + else: + ext_ref = ExternalReference( + type=type, + url=XsUri(value), + comment=comment) if hash_algo and hash: ext_ref.hashes.add(HashType(