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:
parent
7954f4b976
commit
ad361c22ba
2 changed files with 2 additions and 3 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue