From ce210acd326c21b988b9ca6e552a46a43825dba3 Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 15 Mar 2020 23:38:08 +0100 Subject: correct filtering --- src/http/http.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/http/http.go') diff --git a/src/http/http.go b/src/http/http.go index 8f49284..9c618e3 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -95,10 +95,7 @@ func pathHandler(w http.ResponseWriter, r *http.Request) { var dirCount int = 0 var fileCount int = 0 for _, f := range files { - logrus.Tracef("f: %s", f.Name()) - if filterIsValid(f.Name()) == false { - logrus.Tracef("NOPE") continue } @@ -232,18 +229,9 @@ func filterIsValid(name string) bool { } } - logrus.Trace("extension") - extensions := viper.GetStringSlice("hide.extensions") - - splitFileName := strings.Split(name, ".") - fileExtension := splitFileName[len(splitFileName)-1] - logrus.Tracef("fE: %s", fileExtension) - for _, extension := range extensions { - logrus.Tracef("E: %s", extension) - if fileExtension == extension { - logrus.Tracef("E: %s ############################", extension) + if strings.HasSuffix(name, extension) { return false } } -- cgit 1.4.1