Skipped parsing query params if the corresponding flag isn't enabled

This commit is contained in:
Seednode 2022-10-19 20:39:57 -05:00
parent 6508f2d170
commit c8a2e56e92
2 changed files with 9 additions and 4 deletions

View File

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

View File

@ -208,10 +208,15 @@ func serveHtmlHandler(paths []string) appHandler {
} }
filters := Filters{} filters := Filters{}
if Filter {
filters.Includes = splitQueryParams(r.URL.Query().Get("include")) filters.Includes = splitQueryParams(r.URL.Query().Get("include"))
filters.Excludes = splitQueryParams(r.URL.Query().Get("exclude")) filters.Excludes = splitQueryParams(r.URL.Query().Get("exclude"))
}
sortOrder := r.URL.Query().Get("sort") sortOrder := ""
if Sort {
sortOrder = r.URL.Query().Get("sort")
}
switch { switch {
case r.URL.Path == "/" && sortOrder == "asc" && refererUri != "": case r.URL.Path == "/" && sortOrder == "asc" && refererUri != "":