Fixed issue where invalid include/exclude values were being accepted
This commit is contained in:
parent
ea4b1be5c3
commit
5f28361f47
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "0.25.3"
|
var Version = "0.25.4"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
|
16
cmd/web.go
16
cmd/web.go
|
@ -111,21 +111,21 @@ func getSortOrder(r *http.Request) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitQueryParams(query string, regexes *Regexes) []string {
|
func splitQueryParams(query string, regexes *Regexes) []string {
|
||||||
|
results := []string{}
|
||||||
|
|
||||||
if query == "" {
|
if query == "" {
|
||||||
return []string{}
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
params := strings.Split(query, ",")
|
params := strings.Split(query, ",")
|
||||||
|
|
||||||
for i := 0; i < len(params); i++ {
|
for i := 0; i < len(params); i++ {
|
||||||
isAlphanumeric := regexes.Alphanumeric.MatchString(params[i])
|
if regexes.Alphanumeric.MatchString(params[i]) {
|
||||||
|
results = append(results, strings.ToLower(params[i]))
|
||||||
if isAlphanumeric {
|
|
||||||
params[i] = strings.ToLower(params[i])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return params
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateQueryParams(filters *Filters, sortOrder, refreshInterval string) string {
|
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")
|
w.Header().Add("Content-Type", "text/html")
|
||||||
|
|
||||||
refreshInterval := getRefreshInterval(r)
|
|
||||||
|
|
||||||
sortOrder := getSortOrder(r)
|
sortOrder := getSortOrder(r)
|
||||||
|
|
||||||
|
refreshInterval := getRefreshInterval(r)
|
||||||
|
|
||||||
queryParams := generateQueryParams(filters, sortOrder, refreshInterval)
|
queryParams := generateQueryParams(filters, sortOrder, refreshInterval)
|
||||||
|
|
||||||
var htmlBody strings.Builder
|
var htmlBody strings.Builder
|
||||||
|
|
Loading…
Reference in New Issue