Skip to content

Commit

Permalink
fix: error out if target types is not provided instead of assuming ju…
Browse files Browse the repository at this point in the history
…st bot
  • Loading branch information
Your Name committed Nov 5, 2023
1 parent 6c31252 commit 0a87c76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion routes/list/endpoints/search_list/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ func Route(d uapi.RouteData, r *http.Request) uapi.HttpResponse {
}

if len(payload.TargetTypes) == 0 {
payload.TargetTypes = []string{"bot"}
return uapi.HttpResponse{
Status: http.StatusBadRequest,
Json: types.ApiError{Message: "No target types specified"},
}
}

if payload.TagFilter.TagMode != types.TagModeAll && payload.TagFilter.TagMode != types.TagModeAny {
Expand Down
2 changes: 1 addition & 1 deletion routes/list/endpoints/search_list/sql/servers.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AND (cardinality($5::text[]) = 0 OR tags {{.TagMode}} $5) -- Where TagMode is on

{{if .Query}}
AND (
short @@ $6 OR server_id = $7)
name @@ $6 OR short @@ $6 OR server_id = $7)
{{end}}

GROUP BY server_id
Expand Down

0 comments on commit 0a87c76

Please sign in to comment.