adding filename form field + updating echo package to v4 (#57)

This commit is contained in:
Julien Neuhart
2019-03-26 17:35:38 +01:00
committed by GitHub
parent 8a4a043e9f
commit 871b52a288
21 changed files with 140 additions and 47 deletions

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"os"
"github.com/labstack/echo"
"github.com/labstack/echo/v4"
"github.com/thecodingmachine/gotenberg/internal/pkg/printer"
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
)
@@ -29,14 +29,17 @@ func merge(c echo.Context) error {
}
filename := fmt.Sprintf("%s.pdf", baseFilename)
fpath := fmt.Sprintf("%s/%s", r.dirPath, filename)
// if no webhook URL given, run merge
// and directly return the resulting PDF file
// or an error.
if r.webhookURL() == "" {
defer r.removeAll()
// if no webhook URL given, run merge
// and directly return the resulting PDF file
// or an error.
if err := printer.Merge(fpaths, fpath); err != nil {
return err
}
if r.filename() != "" {
filename = r.filename()
}
return c.Attachment(fpath, filename)
}
// as a webhook URL has been given, we