mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
Fix package url for Go modules with no / (#1092)
This commit is contained in:
+4
-2
@@ -47,8 +47,10 @@ func URL(p Package, release *linux.Release) string {
|
||||
case p.Type == GoModulePkg:
|
||||
re := regexp.MustCompile(`(/)[^/]*$`)
|
||||
fields := re.Split(p.Name, -1)
|
||||
namespace = fields[0]
|
||||
name = strings.TrimPrefix(p.Name, namespace+"/")
|
||||
if len(fields) > 1 {
|
||||
namespace = fields[0]
|
||||
name = strings.TrimPrefix(p.Name, namespace+"/")
|
||||
}
|
||||
case p.Type == NpmPkg:
|
||||
fields := strings.SplitN(p.Name, "/", 2)
|
||||
if len(fields) > 1 {
|
||||
|
||||
Reference in New Issue
Block a user