download/util.go

14 lines
254 B
Go

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