From a7dfa21cbf87b7d007dcde285e8a4771b81c393d Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Sat, 12 Apr 2025 17:25:39 +0200 Subject: [PATCH] fix(pdfengines): correct merge order - fixes #1168 --- pkg/gotenberg/sort.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/gotenberg/sort.go b/pkg/gotenberg/sort.go index 0a64ec2f..21922f52 100644 --- a/pkg/gotenberg/sort.go +++ b/pkg/gotenberg/sort.go @@ -1,6 +1,7 @@ package gotenberg import ( + "path/filepath" "regexp" "sort" "strconv" @@ -54,6 +55,9 @@ func (s AlphanumericSort) Less(i, j int) bool { // If that fails, it then attempts a trailing numeric pattern. // If no number is found, it returns -1 and the original string. func extractNumber(str string) (int, string) { + // See https://github.com/gotenberg/gotenberg/issues/1168. + str = filepath.Base(str) + // Check for a numeric prefix. if matches := prefixRegexp.FindStringSubmatch(str); len(matches) > 2 { if num, err := strconv.Atoi(matches[1]); err == nil {