diff --git a/cmd/files.go b/cmd/files.go index 20b73fb..05efdc1 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -87,7 +87,7 @@ func newFile(list []string, sortOrder string, regexes *regexes, formats types.Ty } case sortOrder == "desc": for { - splitPath.increment() + splitPath.number = splitPath.increment() path, err = tryExtensions(splitPath, formats) if err != nil { @@ -95,7 +95,7 @@ func newFile(list []string, sortOrder string, regexes *regexes, formats types.Ty } if path == "" { - splitPath.decrement() + splitPath.number = splitPath.decrement() path, err = tryExtensions(splitPath, formats) if err != nil { @@ -119,9 +119,9 @@ func nextFile(filePath, sortOrder string, regexes *regexes, formats types.Types) switch { case sortOrder == "asc": - splitPath.increment() + splitPath.number = splitPath.increment() case sortOrder == "desc": - splitPath.decrement() + splitPath.number = splitPath.decrement() default: return "", nil } diff --git a/cmd/index.go b/cmd/index.go index 6a8837c..f1a9a37 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -186,13 +186,15 @@ func registerIndexHandlers(mux *httprouter.Router, args []string, index *fileInd func importIndex(args []string, index *fileIndex, formats types.Types) error { if IndexFile != "" { err := index.Import(IndexFile) - if err != nil { - _, err := fileList(args, &filters{}, "", index, formats) - if err != nil { - return err - } + if err == nil { + return nil } } + _, err := fileList(args, &filters{}, "", index, formats) + if err != nil { + return err + } + return nil } diff --git a/cmd/info.go b/cmd/info.go index 852ffa4..9d7de79 100644 --- a/cmd/info.go +++ b/cmd/info.go @@ -19,7 +19,7 @@ import ( "seedno.de/seednode/roulette/types" ) -func paginate(page int, fileCount int, ending bool) string { +func paginateIndex(page int, fileCount int, ending bool) string { var html strings.Builder var firstPage int = 1 @@ -120,8 +120,8 @@ func serveIndexHtml(args []string, index *fileIndex, shouldPaginate bool) httpro htmlBody.WriteString(`table,td,tr{border:none;}td{border-bottom:1px solid black;}td{white-space:nowrap;padding:.5em}`) htmlBody.WriteString(fmt.Sprintf("