diff --git a/download.go b/download.go index 2b0b959..3c09b2e 100644 --- a/download.go +++ b/download.go @@ -37,9 +37,17 @@ func (this *Server) handleViewInternal(w http.ResponseWriter, r *http.Request, f // ServeContent only uses the filename to get the mime type, which we can // set accurately (including blacklist) - w.Header().Set(`Content-Type`, m.MimeType) - if m.MimeType == `application/octet-stream` { + + switch m.MimeType { + case `text/plain`: + w.Header().Set(`Content-Type`, `text/plain; charset=UTF-8`) + + case `application/octet-stream`: + w.Header().Set(`Content-Type`, m.MimeType) w.Header().Set(`Content-Disposition`, `attachment; filename="`+m.Filename+`"`) + + default: + w.Header().Set(`Content-Type`, m.MimeType) } http.ServeContent(w, r, "", m.UploadTime, f)