diff --git a/system/rest/attachment.go b/system/rest/attachment.go index c1f0ab456..5dd463bc6 100644 --- a/system/rest/attachment.go +++ b/system/rest/attachment.go @@ -118,13 +118,13 @@ func (ctrl Attachment) serve(ctx context.Context, attachmentID uint64, preview, fh, err = ctrl.attachment.OpenOriginal(att) } - defer fh.Close() - if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } + defer fh.Close() + name := url.QueryEscape(att.Name) if download {