summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorNick White <git@njw.name>2024-01-28 23:12:31 +0000
committerNick White <git@njw.name>2024-01-28 23:12:37 +0000
commit19d3a4732cf560300463b2a64d697ae579536d84 (patch)
tree3c383266d1d2d25e5e6b75ff87c07e2b4c478664 /internal
parente9db2c568a74323d268959836576f63caa392293 (diff)
Fix issue with directory page images with spaces in the name causing processing errorsguirefactor
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.
Diffstat (limited to 'internal')
-rw-r--r--internal/pipeline/put.go3
1 files changed, 2 insertions, 1 deletions
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)