From 787074fda5c9e4c7c959e20dd8ffe2d39f248a14 Mon Sep 17 00:00:00 2001 From: Antonia Rescribe Date: Mon, 28 Feb 2022 16:41:17 +0100 Subject: adjusted file renaming to make suffixes of png and jpg files lowercase and change jpeg to jpg --- internal/pipeline/put.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/pipeline/put.go b/internal/pipeline/put.go index 47729b5..48ed9a9 100644 --- a/internal/pipeline/put.go +++ b/internal/pipeline/put.go @@ -60,6 +60,9 @@ func CheckImages(ctx context.Context, dir string) error { } suffix := filepath.Ext(path) lsuffix := strings.ToLower(suffix) + if lsuffix == ".jpeg" { + lsuffix = ".jpg" + } if lsuffix != ".jpg" && lsuffix != ".png" { continue } @@ -122,6 +125,9 @@ func UploadImages(ctx context.Context, dir string, bookname string, conn Uploade } origsuffix := filepath.Ext(file.Name()) lsuffix := strings.ToLower(origsuffix) + if lsuffix == ".jpeg" { + lsuffix = ".jpg" + } if lsuffix != ".jpg" && lsuffix != ".png" { continue } @@ -129,7 +135,7 @@ func UploadImages(ctx context.Context, dir string, bookname string, conn Uploade origbase := strings.TrimSuffix(origname, origsuffix) origpath := filepath.Join(dir, origname) - newname := fmt.Sprintf("%s_%04d%s", origbase, filenum, origsuffix) + newname := fmt.Sprintf("%s_%04d%s", origbase, filenum, lsuffix) err = conn.Upload(conn.WIPStorageId(), filepath.Join(bookname, newname), origpath) if err != nil { return fmt.Errorf("Failed to upload %s: %v", origpath, err) -- cgit v1.2.1-24-ge1ad