mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 08:32:16 +01:00
fix(webhook): content-disposition header (#1164)
* fix(webhook): pass content-disposition header through and fix spelling of attachment on default * code review Co-authored-by: Julien Neuhart <neuhart.julien@gmail.com> * formatting --------- Co-authored-by: Julien Neuhart <neuhart.julien@gmail.com>
This commit is contained in:
@@ -239,10 +239,16 @@ func webhookMiddleware(w *Webhook) api.Middleware {
|
||||
}
|
||||
|
||||
headers := map[string]string{
|
||||
echo.HeaderContentDisposition: fmt.Sprintf("attachement; filename=%q", ctx.OutputFilename(outputPath)),
|
||||
echo.HeaderContentType: http.DetectContentType(fileHeader),
|
||||
echo.HeaderContentLength: strconv.FormatInt(fileStat.Size(), 10),
|
||||
traceHeader: trace,
|
||||
echo.HeaderContentType: http.DetectContentType(fileHeader),
|
||||
echo.HeaderContentLength: strconv.FormatInt(fileStat.Size(), 10),
|
||||
traceHeader: trace,
|
||||
}
|
||||
|
||||
// Allow for custom Content-Disposition header.
|
||||
// See https://github.com/gotenberg/gotenberg/issues/1165.
|
||||
_, ok := extraHttpHeaders[echo.HeaderContentDisposition]
|
||||
if !ok {
|
||||
headers[echo.HeaderContentDisposition] = fmt.Sprintf("attachment; filename=%q", ctx.OutputFilename(outputPath))
|
||||
}
|
||||
|
||||
// Send the output file to the webhook.
|
||||
|
||||
Reference in New Issue
Block a user