diff --git a/cmd/version.go b/cmd/version.go index 389844a..8c39b44 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.33.1" +var Version = "0.33.2" func init() { rootCmd.AddCommand(versionCmd) diff --git a/cmd/web.go b/cmd/web.go index 7cb083e..aff7c48 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -81,17 +81,13 @@ func (i *Index) Set(val []string) { i.Mutex.Unlock() } -func (i *Index) GenerateCache(args []string) error { - filters := &Filters{} - +func (i *Index) GenerateCache(args []string) { i.Mutex.Lock() i.List = []string{} i.Mutex.Unlock() fmt.Printf("%v | Preparing image cache...\n", time.Now().Format(LogDate)) - _, err := pickFile(args, filters, "", i) - - return err + getFileList(args, &Filters{}, "", i) } func (i *Index) IsEmpty() bool { @@ -437,10 +433,7 @@ func serveStaticFile(w http.ResponseWriter, r *http.Request, paths []string, sta func serveCacheClearHandler(args []string, index *Index) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - err := index.GenerateCache(args) - if err != nil { - fmt.Println(err) - } + index.GenerateCache(args) w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "text/plain") @@ -582,10 +575,7 @@ func ServePage(args []string) error { } if Cache { - err := index.GenerateCache(args) - if err != nil { - return err - } + index.GenerateCache(args) http.Handle("/_/clear_cache", serveCacheClearHandler(args, index)) }