From c13eac975fde552e1ea2d1d48e4790988783cfb7 Mon Sep 17 00:00:00 2001 From: Seednode Date: Mon, 31 Oct 2022 15:18:47 -0500 Subject: [PATCH] Fixed length of extensions array, and added bmp to the support formats in the readme --- README.md | 2 +- cmd/files.go | 4 ++-- cmd/version.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 34f9e21..b70e059 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A new image will be selected if you open `/` directly, or if you click on any di Browser history is preserved, so you can always go back to any previously displayed image. -Supported file types and extensions are `jp[e]g`, `png`, `gif`, and `webp`. +Supported file types and extensions are `bmp`, `gif`, `jp[e]g`, `png`, and `webp`. Builds available [here](https://cdn.seedno.de/builds/roulette). diff --git a/cmd/files.go b/cmd/files.go index 1748cc6..36430ac 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -31,7 +31,7 @@ import ( var ( ErrNoImagesFound = fmt.Errorf("no supported image formats found") - extensions = [7]string{".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp"} + extensions = [6]string{".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp"} ) type Files struct { @@ -128,7 +128,7 @@ func preparePath(path string) string { } func appendPath(directory, path string, files *Files, stats *Stats) error { - // If caching, check for valid images here, to speed up future pickFile() calls + // If caching, only check image types once, during the initial scan, to speed up future pickFile() calls if Cache { image, err := isImage(path) if err != nil { diff --git a/cmd/version.go b/cmd/version.go index 828856d..a7602a4 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.20.9" +var Version = "0.20.10" func init() { rootCmd.AddCommand(versionCmd)