From 19d3a4732cf560300463b2a64d697ae579536d84 Mon Sep 17 00:00:00 2001 From: Nick White Date: Sun, 28 Jan 2024 23:12:31 +0000 Subject: Fix issue with directory page images with spaces in the name causing processing errors Any page name with a space in (like "page 01.jpg") would cause all book processing to fail, because the queue can't handle file names with spaces in. Fix that by replacing any spaces with underscores in the temporary pipeline files. --- internal/pipeline/put.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/pipeline/put.go b/internal/pipeline/put.go index 48ed9a9..fed04f8 100644 --- a/internal/pipeline/put.go +++ b/internal/pipeline/put.go @@ -135,7 +135,8 @@ 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, lsuffix) + safebase := strings.ReplaceAll(origbase, " ", "_") + newname := fmt.Sprintf("%s_%04d%s", safebase, 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