Skip to content

Commit e168efe

Browse files
committed
Add better PURL support
1 parent 3b7fb4d commit e168efe

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

codeqldepgraph/dependencies.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ def getName(self):
4848
return self.name
4949

5050
def getPurl(self):
51-
return f"pkg:{self.manager}/{self.namespace}/{self.name}@{self.version}"
51+
result = f"pkg:"
52+
if self.manager:
53+
result += f"{self.manager}/"
54+
if self.namespace:
55+
result += f"{self.namespace}/"
56+
result += f"{self.name}"
57+
if self.version:
58+
result += f"@{self.version}"
59+
60+
return result
5261

5362
def __str__(self) -> str:
5463
"""Return a string representation of the dependency"""

0 commit comments

Comments
 (0)