Fixed issue where invalid include/exclude values were being accepted

This commit is contained in:
Seednode 2022-11-10 13:57:38 -06:00
parent ea4b1be5c3
commit 5f28361f47
2 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
var Version = "0.25.3"
var Version = "0.25.4"
func init() {
rootCmd.AddCommand(versionCmd)

View File

@ -111,21 +111,21 @@ func getSortOrder(r *http.Request) string {
}
func splitQueryParams(query string, regexes *Regexes) []string {
results := []string{}
if query == "" {
return []string{}
return results
}
params := strings.Split(query, ",")
for i := 0; i < len(params); i++ {
isAlphanumeric := regexes.Alphanumeric.MatchString(params[i])
if isAlphanumeric {
params[i] = strings.ToLower(params[i])
if regexes.Alphanumeric.MatchString(params[i]) {
results = append(results, strings.ToLower(params[i]))
}
}
return params
return results
}
func generateQueryParams(filters *Filters, sortOrder, refreshInterval string) string {
@ -212,10 +212,10 @@ func serveHtml(w http.ResponseWriter, r *http.Request, filePath string, dimensio
w.Header().Add("Content-Type", "text/html")
refreshInterval := getRefreshInterval(r)
sortOrder := getSortOrder(r)
refreshInterval := getRefreshInterval(r)
queryParams := generateQueryParams(filters, sortOrder, refreshInterval)
var htmlBody strings.Builder