fix(pdfengines): correct merge order - fixes #1168

This commit is contained in:
Julien Neuhart
2025-04-12 17:25:39 +02:00
parent ab81444773
commit a7dfa21cbf

View File

@@ -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 {