From 68ceea3f8d788cfab912491af7eb7384701457a6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 12 May 2014 22:59:00 -0700 Subject: [PATCH] support file names with a comma inside. --- go/util/http_util.go | 1 + go/weed/weed_server/volume_server_handlers.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go/util/http_util.go b/go/util/http_util.go index 6562e964c..5d46cb9b3 100644 --- a/go/util/http_util.go +++ b/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!") diff --git a/go/weed/weed_server/volume_server_handlers.go b/go/weed/weed_server/volume_server_handlers.go index 76b760d46..333a40377 100644 --- a/go/weed/weed_server/volume_server_handlers.go +++ b/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() {