-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: type hint for get_component_by_purl is incorrect #310
Conversation
Signed-off-by: gruebel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR needs to be discussed - see #310 (comment)
Thanks for the bug report, @gruebel, but to me it appears that
you bring up breaking (arch/design - not code) changes that alter the original method(API) in its meaning.
Here is a fix that does not introduce breaking changes, but actually fixes a bug
diff --git a/cyclonedx/model/bom.py b/cyclonedx/model/bom.py
--- a/cyclonedx/model/bom.py (revision 6c0c1742d2ea19dfc0284785cf9597b43ef05979)
+++ b/cyclonedx/model/bom.py (date 1665226315792)
@@ -300,7 +300,7 @@
`Component` or `None`
"""
if purl:
- found = list(filter(lambda x: x.purl == purl, self.components))
+ found = list(filter(lambda x: str(x.purl) == purl, self.components))
if len(found) == 1:
return found[0]
PS: turned out that the actual bugfix is not inteded, but a documentation fix - see #310 (comment)
yeap, we are using it in |
In python the typing is optional and has no meaning for the runtime. Even though I would argue that it is a breaking change from architectural/design perspective. |
Signed-off-by: gruebel <[email protected]>
that's correct. if it was differently intended, then you should probably put it into v4 release branch 🙂 |
hey @jkowalleck any plan on merging my change 🙂 |
re: #310 (comment) we will see how to get this very PR integrated. |
I'm happy to merge this - from my checks, |
Thanks @gruebel and @jkowalleck ! |
Signed-off-by: gruebel [email protected]
get_component_by_purl
and added a test for it 🙂