fix(releases): search with postgres (#1181)

* fix(releases): search with postgres

* fix: validate release push status from filters

* fix: add missing import

* fix: validate push status if not empty
This commit is contained in:
ze0s 2023-10-16 20:27:15 +02:00 committed by GitHub
parent faaec5625a
commit 06b864da4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View file

@ -5,6 +5,7 @@ package http
import (
"context"
"fmt"
"net/http"
"net/url"
"strconv"
@ -97,6 +98,16 @@ func (h releaseHandler) findReleases(w http.ResponseWriter, r *http.Request) {
indexer := vals["indexer"]
pushStatus := r.URL.Query().Get("push_status")
if pushStatus != "" {
if !domain.ValidReleasePushStatus(pushStatus) {
h.encoder.StatusResponse(w, http.StatusBadRequest, map[string]interface{}{
"code": "BAD_REQUEST_PARAMS",
"message": fmt.Sprintf("push_status parameter is of invalid type: %v", pushStatus),
})
return
}
}
search := r.URL.Query().Get("q")
query := domain.ReleaseQueryParams{