Skip to content

Commit df348dc

Browse files
frostmarcrozzy
authored andcommitted
httptransport: GET vuln report returns 404 when indexing in-progress
Signed-off-by: Mark Frost <[email protected]>
1 parent 3e5740e commit df348dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

httptransport/matcher_v1.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

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

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

0 commit comments

Comments
 (0)