diff --git a/cmd/files.go b/cmd/files.go index ee207a8..9c3fdc1 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -460,6 +460,7 @@ func scanPath(path string, files *Files, filters *Filters, stats *ScanStats, con go func() { defer func() { <-concurrency.fileScans + wg.Done() }() @@ -523,6 +524,7 @@ func fileList(paths []string, filters *Filters, sort string, index *Index) ([]st go func(i int) { defer func() { <-concurrency.directoryScans + wg.Done() }() diff --git a/cmd/web.go b/cmd/web.go index 7c54003..2ad9126 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -325,6 +325,7 @@ func (s *ServeStats) GetMostServed() string { for _, v := range stats.List { if retVal == "" { retVal = v + continue } @@ -603,7 +604,9 @@ func serveCacheClear(args []string, index *Index) httprouter.Handle { index.generateCache(args) w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "text/plain") + w.Write([]byte("Ok")) } } @@ -629,6 +632,7 @@ func serveStats(args []string, stats *ServeStats) httprouter.Handle { response, err := stats.ListImages() if err != nil { fmt.Println(err) + return } @@ -735,12 +739,14 @@ func serveStaticFile(paths []string, stats *ServeStats) httprouter.Handle { prefixedFilePath, err := stripQueryParams(path) if err != nil { fmt.Println(err) + return } filePath, err := filepath.EvalSymlinks(strings.TrimPrefix(prefixedFilePath, SourcePrefix)) if err != nil { fmt.Println(err) + return } @@ -753,6 +759,7 @@ func serveStaticFile(paths []string, stats *ServeStats) httprouter.Handle { exists, err := fileExists(filePath) if err != nil { fmt.Println(err) + return } @@ -767,6 +774,7 @@ func serveStaticFile(paths []string, stats *ServeStats) httprouter.Handle { buf, err := os.ReadFile(filePath) if err != nil { fmt.Println(err) + return }