index fix
alex wennerberg alex@alexwennerberg.com
Sat, 24 Oct 2020 14:38:40 -0700
2 files changed,
11 insertions(+),
8 deletions(-)
M
main.go
→
main.go
@@ -61,17 +61,20 @@ }
func getIndexFiles() ([]*File, error) { // cache this function result := []*File{} - err := filepath.Walk(c.FilesDirectory, func(path string, info os.FileInfo, err error) error { + 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", path, err) + log.Printf("Failure accessing a path %q: %v\n", thepath, err) return err // think about } // make this do what it should - result = append(result, &File{ - Name: info.Name(), - Creator: "alex", - UpdatedTime: info.ModTime(), - }) + if !info.IsDir() { + creatorFolder, _ := path.Split(thepath) + result = append(result, &File{ + Name: info.Name(), + Creator: path.Base(creatorFolder), + UpdatedTime: info.ModTime(), + }) + } return nil }) if err != nil {
M
schema.sql
→
schema.sql
@@ -3,7 +3,7 @@ id INTEGER PRIMARY KEY NOT NULL,
username TEXT NOT NULL UNIQUE, email TEXT NOT NULL UNIQUE, password_hash TEXT NOT NULL, - active boolean NOT NULL DEFAULT false, + approved boolean NOT NULL DEFAULT false, created_at INTEGER DEFAULT (strftime('%s', 'now')) );