support file names with a comma inside.

This commit is contained in:
Chris Lu 2014-05-12 22:59:00 -07:00
parent 328aa48c6a
commit 68ceea3f8d
2 changed files with 2 additions and 1 deletions

View file

@ -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!")

View file

@ -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() {