Skip to content

Commit

Permalink
httptransport: GET vuln report returns 404 when indexing in-progress
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Frost <[email protected]>
  • Loading branch information
frostmar authored and crozzy committed Mar 12, 2024
1 parent 3e5740e commit 546fedc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions httptransport/matcher_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/google/uuid"
"github.com/quay/claircore"
indexerController "github.com/quay/claircore/indexer/controller"
"github.com/quay/claircore/libvuln/driver"
"github.com/quay/zlog"
oteltrace "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
Expand Down Expand Up @@ -125,9 +126,10 @@ func (h *MatcherV1) vulnerabilityReport(w http.ResponseWriter, r *http.Request)
if err != nil {
apiError(ctx, w, http.StatusInternalServerError, "experienced a server side error: %v", err)
}
// now check bool only after confirming no err
if !ok {
// now check present and finished only after confirming no err
if !ok || indexReport.State != indexerController.IndexFinished.String() {
apiError(ctx, w, http.StatusNotFound, "index report for manifest %q not found", manifest.String())
return
}

vulnReport, err := h.srv.Scan(ctx, indexReport)
Expand Down

0 comments on commit 546fedc

Please sign in to comment.