feat: support multiple owners per registry (comma-separated)

This commit is contained in:
2026-03-28 14:15:42 +03:00
parent 5e366fb2ab
commit 4ba3673b96
3 changed files with 22 additions and 7 deletions
+20 -5
View File
@@ -2,7 +2,9 @@ package api
import (
"errors"
"log/slog"
"net/http"
"strings"
"github.com/go-chi/chi/v5"
@@ -309,11 +311,24 @@ func (s *Server) listRegistryImages(w http.ResponseWriter, r *http.Request) {
return
}
images, err := client.ListImages(r.Context(), reg.Owner)
if err != nil {
respondError(w, http.StatusBadGateway, "failed to list images: "+err.Error())
return
// Support comma-separated owners (e.g., "alexei,team-org,other-user").
owners := strings.Split(reg.Owner, ",")
var allImages []registry.RegistryImage
for _, owner := range owners {
owner = strings.TrimSpace(owner)
if owner == "" {
continue
}
images, err := client.ListImages(r.Context(), owner)
if err != nil {
slog.Warn("failed to list images for owner", "owner", owner, "error", err)
continue
}
allImages = append(allImages, images...)
}
if allImages == nil {
allImages = []registry.RegistryImage{}
}
respondJSON(w, http.StatusOK, images)
respondJSON(w, http.StatusOK, allImages)
}