about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2020-03-15 23:38:08 +0100
committerEmile <hanemile@protonmail.com>2020-03-15 23:38:08 +0100
commitce210acd326c21b988b9ca6e552a46a43825dba3 (patch)
tree8ed6704352e6e090c75adc37c9469cd89c5e2686
parentf41c2acbc5765c51d3a9e05131fdde21ee5eb612 (diff)
correct filtering
-rw-r--r--src/http/http.go14
1 files changed, 1 insertions, 13 deletions
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
 		}
 	}