mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #302 from alexanderk23/fix_content_disposition_header
Fix Content-Disposition header
This commit is contained in:
commit
e639f1f889
|
@ -197,7 +197,13 @@ func writeResponseContent(filename, mimeType string, rs io.ReadSeeker, w http.Re
|
||||||
w.Header().Set("Content-Type", mimeType)
|
w.Header().Set("Content-Type", mimeType)
|
||||||
}
|
}
|
||||||
if filename != "" {
|
if filename != "" {
|
||||||
w.Header().Set("Content-Disposition", `filename="`+fileNameEscaper.Replace(filename)+`"`)
|
contentDisposition := "inline"
|
||||||
|
if r.FormValue("dl") != "" {
|
||||||
|
if dl, _ := strconv.ParseBool(r.FormValue("dl")); dl {
|
||||||
|
contentDisposition = "attachment"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Header().Set("Content-Disposition", contentDisposition+`; filename="`+fileNameEscaper.Replace(filename)+`"`)
|
||||||
}
|
}
|
||||||
w.Header().Set("Accept-Ranges", "bytes")
|
w.Header().Set("Accept-Ranges", "bytes")
|
||||||
if r.Method == "HEAD" {
|
if r.Method == "HEAD" {
|
||||||
|
|
Loading…
Reference in a new issue