diff options
author | Emile <hanemile@protonmail.com> | 2020-03-15 23:24:20 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-03-15 23:24:20 +0100 |
commit | fbbbee4a952d24f5670fc614090e896e8c221eb2 (patch) | |
tree | 6f4f45ee423f3ec6f8f011a7b8960c0413d1a163 /src/http | |
parent | 82f4077b6fcfb051cef9df3d3a1809477a2e2c4a (diff) |
fixed the filters
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/http.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/http/http.go b/src/http/http.go index cdfdf68..17b0963 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -98,8 +98,7 @@ func pathHandler(w http.ResponseWriter, r *http.Request) { for _, f := range files { logrus.Tracef("f: %s", f.Name()) - filterResult := filterIsValid(f.Name()) - if filterResult == true { + if filterIsValid(f.Name()) == false { continue } @@ -229,22 +228,23 @@ func filterIsValid(name string) bool { // hide files starting with a dot if the "hide.file" directive is set if viper.GetBool("hide.files") == true { - logrus.Info("checking hide") - if name[0] != '.' { - logrus.Info("hide") + if name[0] == '.' { return false } } + logrus.Info("extension") + extensions := viper.GetStringSlice("hide.extensions") splitFileName := strings.Split(name, ".") fileExtension := splitFileName[len(splitFileName)-1] + logrus.Infof("fE: %s", fileExtension) for _, extension := range extensions { + logrus.Infof("E: %s", extension) if fileExtension == extension { - logrus.Info("extension") - logrus.Info(extension) + logrus.Infof("E: %s ############################", extension) return false } } |