Allow admin to view hidden files on TL
alex wennerberg alex@alexwennerberg.com
Sat, 05 Dec 2020 17:46:08 -0800
M
main.go
→
main.go
@@ -97,14 +97,14 @@ r := strings.Split(filePath, "/")[l]
return r } -func getIndexFiles() ([]*File, error) { // cache this function +func getIndexFiles(admin bool) ([]*File, error) { // cache this function result := []*File{} err := filepath.Walk(c.FilesDirectory, func(thepath string, info os.FileInfo, err error) error { if err != nil { log.Printf("Failure accessing a path %q: %v\n", thepath, err) return err // think about } - if info.IsDir() && info.Name() == HIDDEN_FOLDER { + if !admin && info.IsDir() && info.Name() == HIDDEN_FOLDER { return filepath.SkipDir } // make this do what it should