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