working commit

This commit is contained in:
2026-02-23 10:43:54 +02:00
parent b6efc19f7a
commit 96b24c6b63
4 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -476,13 +476,13 @@ type ListManifestsParams struct {
N int64
}
type ListManifestsResult struct {
Catalog []string `json:"repositories"`
Repositories []string `json:"repositories"`
}
func (oper *Operator) ListManifests(ctx context.Context, params *ListManifestsParams) (*ListManifestsResult, int, error) {
var err error
res := &ListManifestsResult{
Catalog: make([]string, 0),
Repositories: make([]string, 0),
}
refMap := make(map[string]bool)
descrs, err := oper.mdb.ListAllManifests(ctx)
@@ -490,14 +490,14 @@ func (oper *Operator) ListManifests(ctx context.Context, params *ListManifestsPa
return res, http.StatusInternalServerError, err
}
for _, descr := range descrs {
_, yet := refMap[descr.Reference]
if !yet {
refMap[descr.Reference] = true
_, already := refMap[descr.Name]
if !already {
refMap[descr.Name] = true
}
}
for key, _ := range refMap {
res.Catalog = append(res.Catalog, key)
res.Repositories = append(res.Repositories, key)
}
slices.Sort(res.Catalog)
slices.Sort(res.Repositories)
return res, http.StatusOK, err
}