mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
fix(pdfengines): only preserve filenames in zip archive
This commit is contained in:
@@ -158,7 +158,12 @@ func convertRoute(engine gotenberg.PdfEngine) api.Route {
|
||||
outputPaths := make([]string, len(inputPaths))
|
||||
|
||||
for i, inputPath := range inputPaths {
|
||||
outputPaths[i] = ctx.GeneratePath(strings.TrimSuffix(filepath.Base(inputPath), filepath.Ext(inputPath)), ".pdf")
|
||||
if len(outputPaths) > 1 {
|
||||
// If .zip archive, keep the original filenames.
|
||||
outputPaths[i] = ctx.GeneratePath(strings.TrimSuffix(filepath.Base(inputPath), filepath.Ext(inputPath)), ".pdf")
|
||||
} else {
|
||||
outputPaths[i] = ctx.GeneratePath("", ".pdf")
|
||||
}
|
||||
|
||||
err = engine.Convert(ctx, ctx.Log(), pdfFormats, inputPath, outputPaths[i])
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user