From fef51438c050520960b0748fd523a51086ee426d Mon Sep 17 00:00:00 2001 From: Seednode Date: Sun, 17 Dec 2023 05:28:24 -0600 Subject: [PATCH] Append newline to index rebuild HTTP response; remove unneeded error handling for index rebuild handler registration --- cmd/files.go | 6 ------ cmd/index.go | 8 +------- cmd/root.go | 2 +- cmd/web.go | 5 +---- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 1e1e0a2..f8b949d 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -433,12 +433,6 @@ Poll: } } - if filesMatched < 1 { - fmt.Println("No files matched") - - return []string{}, nil - } - if Verbose { fmt.Printf("%s | INDEX: Selected %d/%d files across %d/%d directories in %s\n", time.Now().Format(logDate), diff --git a/cmd/index.go b/cmd/index.go index f1a9a37..3cb8f2a 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -173,16 +173,10 @@ func serveIndexRebuild(args []string, index *fileIndex, formats types.Types, err w.Header().Set("Content-Type", "text/plain") - w.Write([]byte("Ok")) + w.Write([]byte("Ok\n")) } } -func registerIndexHandlers(mux *httprouter.Router, args []string, index *fileIndex, formats types.Types, errorChannel chan<- error) error { - registerHandler(mux, Prefix+"/index/rebuild", serveIndexRebuild(args, index, formats, errorChannel)) - - return nil -} - func importIndex(args []string, index *fileIndex, formats types.Types) error { if IndexFile != "" { err := index.Import(IndexFile) diff --git a/cmd/root.go b/cmd/root.go index 32dfa5b..7d0c696 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "3.3.1" + ReleaseVersion string = "3.3.2" ) var ( diff --git a/cmd/web.go b/cmd/web.go index 12fc590..c318233 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -544,10 +544,7 @@ func ServePage(args []string) error { registerHandler(mux, Prefix+"/version", serveVersion()) if Index { - err = registerIndexHandlers(mux, args, index, formats, errorChannel) - if err != nil { - return err - } + registerHandler(mux, Prefix+"/index/rebuild", serveIndexRebuild(args, index, formats, errorChannel)) err = importIndex(paths, index, formats) if err != nil {