forked from security/hakurei
cmd/pkgserver: handle unversioned value
This omits the field for an unversioned artifact, and only does so once on startup. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"unique"
|
"unique"
|
||||||
@@ -53,6 +54,12 @@ func (index *packageIndex) populate(cache *pkg.Cache, report *rosa.Report) (err
|
|||||||
Metadata: rosa.GetMetadata(p),
|
Metadata: rosa.GetMetadata(p),
|
||||||
Version: rosa.Std.Version(p),
|
Version: rosa.Std.Version(p),
|
||||||
}
|
}
|
||||||
|
if m.Version == "" {
|
||||||
|
return errors.New("invalid version from " + m.Name)
|
||||||
|
}
|
||||||
|
if m.Version == rosa.Unversioned {
|
||||||
|
m.Version = ""
|
||||||
|
}
|
||||||
|
|
||||||
if cache != nil && report != nil {
|
if cache != nil && report != nil {
|
||||||
m.ident = cache.Ident(rosa.Std.Load(p))
|
m.ident = cache.Ident(rosa.Std.Load(p))
|
||||||
|
|||||||
Reference in New Issue
Block a user