From 022b14bfa27de0ff903217e975988a9aa172410b Mon Sep 17 00:00:00 2001 From: Seednode Date: Tue, 18 Oct 2022 16:46:55 -0500 Subject: [PATCH] Fixed unhandled error return value --- cmd/files.go | 12 +++++++++--- cmd/version.go | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 0accbdc..24a2759 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -82,6 +82,9 @@ func getLastFile(p Path) (string, error) { p.Decrement() fileName, err = tryExtensions(p) + if err != nil { + return "", err + } break } @@ -113,6 +116,9 @@ func getPreviousFile(p Path) (string, error) { } func splitPath(path string) (Path, error) { + p := Path{} + var err error + re := regexp.MustCompile(`(.+)([0-9]{3})(\..+)`) split := re.FindAllStringSubmatch(path, -1) @@ -121,14 +127,13 @@ func splitPath(path string) (Path, error) { return Path{}, nil } - p := Path{} - var err error - p.Base = split[0][1] + p.Number, err = strconv.Atoi(split[0][2]) if err != nil { return Path{}, err } + p.Extension = split[0][3] return p, nil @@ -303,6 +308,7 @@ func pickFile(args []string, filter, sorting string) (string, error) { if err != nil { return "", err } + if isImage { return filePath, nil } diff --git a/cmd/version.go b/cmd/version.go index e279e02..ce24da5 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.13.1" +var Version = "0.13.2" func init() { rootCmd.AddCommand(versionCmd)