1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 23:59:47 +02:00

Write HTTP headers before body write

This commit is contained in:
sauls8t 2019-11-08 10:40:10 +00:00
parent 7954f4b976
commit ad361c22ba
2 changed files with 2 additions and 3 deletions

View file

@ -180,6 +180,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
dataSize := len(a.Data)
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", typ)
w.Header().Set("Content-Disposition", `Attachment; filename="`+a.Filename+`" ; `+`filename*="`+a.Filename+`"`)
if dataSize != 0 {
@ -191,7 +192,6 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
h.Runtime.Log.Error("write attachment", err)
return
}
w.WriteHeader(http.StatusOK)
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDownload)
}