working commit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user