serve text/plain content with charset=utf-8 header
This commit is contained in:
parent
c958c57794
commit
524f37d9fe
10
download.go
10
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)
|
||||
|
||||
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)
|
||||
if m.MimeType == `application/octet-stream` {
|
||||
w.Header().Set(`Content-Disposition`, `attachment; filename="`+m.Filename+`"`)
|
||||
|
||||
default:
|
||||
w.Header().Set(`Content-Type`, m.MimeType)
|
||||
}
|
||||
|
||||
http.ServeContent(w, r, "", m.UploadTime, f)
|
||||
|
Loading…
Reference in New Issue
Block a user