def filename_from_content_disposition(content_disposition):
 msg = Message(('Content-Disposition: %s' % content_disposition))
 filename = msg.get_filename()
 if filename:
  filename = os.path.basename(filename).lstrip('.').strip()
  if filename:
   return filename

def filename_from_content_disposition ( content_disposition ) : msg = Message ( ( 'Content-Disposition: %s' % content_disposition ) ) filename = msg . get_filename ( ) if filename : filename = os . path . basename ( filename ) . lstrip ( '.' ) . strip ( ) if filename : return filename
extract and validate filename from a content-disposition header .