Browse Source

weed filer: set content-type consistent with filer store

pull/914/head
Chris Lu 6 years ago
parent
commit
65757ae2fd
  1. 5
      weed/server/filer_server_handlers_read.go

5
weed/server/filer_server_handlers_read.go

@ -111,13 +111,16 @@ func (fs *FilerServer) handleSingleChunk(w http.ResponseWriter, r *http.Request,
for k, v := range resp.Header { for k, v := range resp.Header {
w.Header()[k] = v w.Header()[k] = v
} }
if entry.Attr.Mime != "" {
w.Header().Set("Content-Type", entry.Attr.Mime)
}
w.WriteHeader(resp.StatusCode) w.WriteHeader(resp.StatusCode)
io.Copy(w, resp.Body) io.Copy(w, resp.Body)
} }
func (fs *FilerServer) handleMultipleChunks(w http.ResponseWriter, r *http.Request, entry *filer2.Entry) { func (fs *FilerServer) handleMultipleChunks(w http.ResponseWriter, r *http.Request, entry *filer2.Entry) {
mimeType := entry.Mime
mimeType := entry.Attr.Mime
if mimeType == "" { if mimeType == "" {
if ext := path.Ext(entry.Name()); ext != "" { if ext := path.Ext(entry.Name()); ext != "" {
mimeType = mime.TypeByExtension(ext) mimeType = mime.TypeByExtension(ext)

Loading…
Cancel
Save