(content_disposition, default_filename)
return filename or default_filename
Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
Parse the filename value from a Content - Disposition header and return the default filename if the result is empty .
def parse_content_disposition(content_disposition, default_filename):
    # type: (str, str) -> str
    """
    Parse the "filename" value from a Content-Disposition header, and
    return the default filename if the result is empty.
    """
    _type, params = cgi.parse_header(content_disposition)
    filename = params.get('filename')
    if filename:
        # We need to sanitize the filename to prevent directory traversal
        # in case the filename contains ".." path parts.
        filename = sanitize_content_filename(filename)
    return filename or default_filename
def parse_content_disposition ( content_disposition , default_filename ) : # type: (str, str) -> str _type , params = cgi . parse_header ( content_disposition ) filename = params . get ( 'filename' ) if filename : # We need to sanitize the filename to prevent directory traversal # in case the filename contains ".." path parts. filename = sanitize_content_filename ( filename ) return filename or default_filename