download/util.go

14 lines
254 B
Go
Raw Normal View History

package download
import (
"mime"
)
func getFileNameFromHeaderContentDisposition(value string) string {
disposition, params, err := mime.ParseMediaType(value)
if err != nil || disposition != "attachment" {
return ""
}
return params["filename"]
}