From def89b5aea81f64cbaeed07509fe044c8a1a4409 Mon Sep 17 00:00:00 2001 From: Icereed Date: Mon, 28 Oct 2024 23:05:25 +0100 Subject: [PATCH] fix: Put OCR pages into correct order (#38) A race condition caused the pages to be in a mixed order. --- paperless.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paperless.go b/paperless.go index ec2ecb4..b477324 100644 --- a/paperless.go +++ b/paperless.go @@ -11,6 +11,7 @@ import ( "net/http" "os" "path/filepath" + "slices" "strings" "sync" @@ -411,6 +412,9 @@ func (c *PaperlessClient) DownloadDocumentAsImages(ctx context.Context, document return nil, err } + // sort the image paths to ensure they are in order + slices.Sort(imagePaths) + return imagePaths, nil }