Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix the bug than we can't get filename when download file.

wangjie90a6f43c5610
diff --git a/weed/util/http_util.go b/weed/util/http_util.go
index 83302663e9..f3e97f6f14 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, "\"")
}
}