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:
2026-03-11 02:52:23 +09:00
parent 50649fdbf4
commit dac33d7720

View File

@@ -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))