Skip to content

Commit

Permalink
Return not found errors when applicable
Browse files Browse the repository at this point in the history
Solves: #11
  • Loading branch information
AlexGustafsson committed Dec 16, 2024
1 parent c014e31 commit d468317
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func NewServer(api *store.Store, processQueue chan<- oci.Reference) *Server {
reference := query.Get("reference")

response, err := api.GetImage(r.Context(), reference)
if response == nil && err == nil {
s.handleGenericResponse(w, r, ErrNotFound)
return
}

s.handleJSONResponse(w, r, response, err)
})

Expand All @@ -107,6 +112,11 @@ func NewServer(api *store.Store, processQueue chan<- oci.Reference) *Server {
reference := query.Get("reference")

response, err := api.GetImageDescription(r.Context(), reference)
if response == nil && err == nil {
s.handleGenericResponse(w, r, ErrNotFound)
return
}

s.handleJSONResponse(w, r, response, err)
})

Expand All @@ -116,6 +126,11 @@ func NewServer(api *store.Store, processQueue chan<- oci.Reference) *Server {
reference := query.Get("reference")

response, err := api.GetImageReleaseNotes(r.Context(), reference)
if response == nil && err == nil {
s.handleGenericResponse(w, r, ErrNotFound)
return
}

s.handleJSONResponse(w, r, response, err)
})

Expand Down

0 comments on commit d468317

Please sign in to comment.