Browse Source

support file names with a comma inside.

pull/2/head
Chris Lu 11 years ago
parent
commit
68ceea3f8d
  1. 1
      go/util/http_util.go
  2. 2
      go/weed/weed_server/volume_server_handlers.go

1
go/util/http_util.go

@ -100,6 +100,7 @@ func DownloadUrl(fileUrl string) (filename string, content []byte, e error) {
glog.V(4).Info("Content-Disposition: ", contentDisposition[0])
if strings.HasPrefix(contentDisposition[0], "filename=") {
filename = contentDisposition[0][len("filename="):]
filename = strings.Trim(filename, "\"")
}
} else {
glog.V(4).Info("No Content-Disposition!")

2
go/weed/weed_server/volume_server_handlers.go

@ -111,7 +111,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
w.Header().Set("Content-Type", mtype)
}
if filename != "" {
w.Header().Set("Content-Disposition", "filename="+fileNameEscaper.Replace(filename))
w.Header().Set("Content-Disposition", "filename=\""+fileNameEscaper.Replace(filename)+"\"")
}
if ext != ".gz" {
if n.IsGzipped() {

Loading…
Cancel
Save