diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2017-01-09 00:11:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-09 00:11:27 -0800 |
| commit | 07a51815e9f2aeb8d196be5136323a77bb24acc7 (patch) | |
| tree | 6bea3c402d0265aba96284684ded3b6ca0fa1bc1 | |
| parent | 53cf1b4900630883ef38a95324cda29f50e75b8d (diff) | |
| parent | 90a6f43c5610cf9d05f043f2630fab56b3202a69 (diff) | |
| download | seaweedfs-07a51815e9f2aeb8d196be5136323a77bb24acc7.tar.xz seaweedfs-07a51815e9f2aeb8d196be5136323a77bb24acc7.zip | |
Merge pull request #434 from wangjie/master
fix the bug that we can't get filename when download file.
| -rw-r--r-- | weed/util/http_util.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 83302663e..f3e97f6f1 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -148,8 +148,9 @@ func DownloadUrl(fileUrl string) (filename string, rc io.ReadCloser, e error) { } contentDisposition := response.Header["Content-Disposition"] if len(contentDisposition) > 0 { - if strings.HasPrefix(contentDisposition[0], "filename=") { - filename = contentDisposition[0][len("filename="):] + idx := strings.Index(contentDisposition[0], "filename=") + if idx != -1 { + filename = contentDisposition[0][idx+len("filename="):] filename = strings.Trim(filename, "\"") } } |
