Fix package url for Go modules with no / (#1092)

This commit is contained in:
Rob Best
2022-07-11 10:07:34 -04:00
committed by GitHub
parent b3a7b912e1
commit 2f1aa33ce8
2 changed files with 24 additions and 3 deletions
+4 -2
View File
@@ -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 {