Browse Source

fier/s3: save "Content-Disposition" to extended properties

related to https://github.com/chrislusf/seaweedfs/issues/2371
pull/2376/head
Chris Lu 3 years ago
parent
commit
de1ec050e8
  1. 3
      weed/server/common.go
  2. 2
      weed/server/filer_server_handlers_write_autochunk.go

3
weed/server/common.go

@ -256,6 +256,9 @@ func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, file
w.Header().Set("Content-Disposition", responseContentDisposition) w.Header().Set("Content-Disposition", responseContentDisposition)
return return
} }
if w.Header().Get("Content-Disposition") != "" {
return
}
if filename != "" { if filename != "" {
filename = url.QueryEscape(filename) filename = url.QueryEscape(filename)
contentDisposition := "inline" contentDisposition := "inline"

2
weed/server/filer_server_handlers_write_autochunk.go

@ -218,7 +218,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
entry.Extended = SaveAmzMetaData(r, entry.Extended, false) entry.Extended = SaveAmzMetaData(r, entry.Extended, false)
for k, v := range r.Header { for k, v := range r.Header {
if len(v) > 0 && (strings.HasPrefix(k, needle.PairNamePrefix) || k == "Cache-Control" || k == "Expires") {
if len(v) > 0 && (strings.HasPrefix(k, needle.PairNamePrefix) || k == "Cache-Control" || k == "Expires" || k == "Content-Disposition") {
entry.Extended[k] = []byte(v[0]) entry.Extended[k] = []byte(v[0])
} }
} }

Loading…
Cancel
Save