mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix the bug than we can't get filename when download file.
This commit is contained in:
parent
53cf1b4900
commit
90a6f43c56
|
@ -148,8 +148,9 @@ func DownloadUrl(fileUrl string) (filename string, rc io.ReadCloser, e error) {
|
||||||
}
|
}
|
||||||
contentDisposition := response.Header["Content-Disposition"]
|
contentDisposition := response.Header["Content-Disposition"]
|
||||||
if len(contentDisposition) > 0 {
|
if len(contentDisposition) > 0 {
|
||||||
if strings.HasPrefix(contentDisposition[0], "filename=") {
|
idx := strings.Index(contentDisposition[0], "filename=")
|
||||||
filename = contentDisposition[0][len("filename="):]
|
if idx != -1 {
|
||||||
|
filename = contentDisposition[0][idx+len("filename="):]
|
||||||
filename = strings.Trim(filename, "\"")
|
filename = strings.Trim(filename, "\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue