diff --git a/internal/pkg/printer/merge.go b/internal/pkg/printer/merge.go index b8d4fa5b..bc663b3d 100644 --- a/internal/pkg/printer/merge.go +++ b/internal/pkg/printer/merge.go @@ -2,6 +2,7 @@ package printer import ( "context" + "sort" "github.com/thecodingmachine/gotenberg/internal/pkg/conf" "github.com/thecodingmachine/gotenberg/internal/pkg/xcontext" @@ -54,6 +55,8 @@ func (p mergePrinter) Print(destination string) error { defer cancel() p.ctx = ctx } + // see https://github.com/thecodingmachine/gotenberg/issues/139. + sort.Strings(p.fpaths) p.logger.DebugfOp(op, "merging '%v'...", p.fpaths) resolver := func() error { var args []string diff --git a/internal/pkg/printer/office.go b/internal/pkg/printer/office.go index 8a21ff2e..1b31d461 100644 --- a/internal/pkg/printer/office.go +++ b/internal/pkg/printer/office.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "sort" "github.com/phayes/freeport" "github.com/thecodingmachine/gotenberg/internal/pkg/conf" @@ -53,6 +54,8 @@ func (p officePrinter) Print(destination string) error { ctx, cancel := xcontext.WithTimeout(p.logger, p.opts.WaitTimeout) defer cancel() resolver := func() error { + // see https://github.com/thecodingmachine/gotenberg/issues/139. + sort.Strings(p.fpaths) fpaths := make([]string, len(p.fpaths)) dirPath := filepath.Dir(destination) for i, fpath := range p.fpaths {