fix: resolve http non encode attachment filename (#975)

This commit is contained in:
Levi authored and GitHub committed 2025-04-05 22:37:19 +08:00
1 parent 50bc9ab129
commit cd5fd45667
4 files changed
+39 -2

No files matched your search

+14
View File
@@ -174,6 +174,12 @@ func (f *Fetcher) Resolve(req *base.Request) error {
} else {
file.Name = filename
}
} else {
substr := "attachment; filename="
index := strings.Index(contentDisposition, substr)
if index != -1 {
file.Name = contentDisposition[index+len(substr):]
}
}
}
// get file filePath by URL
@@ -610,6 +616,14 @@ func (f *Fetcher) buildClient() *http.Client {
}
}
func decodeMangledString(mangled string) string {
rawBytes := make([]byte, 0, len(mangled)*3)
for _, r := range mangled {
rawBytes = append(rawBytes, byte(r))
}
return string(rawBytes)
}
type fetcherData struct {
Connections []*connection
}