get_filename_from_url_or_default

Function get_filename_from_url_or_default 

Source
pub fn get_filename_from_url_or_default(
    url_str: &str,
    default_filename: &str,
) -> String
Expand description

Tries to extract the filename from a URL. If the URL cannot be parsed or does not contain a filename in the path, it returns the provided default filename.

§Arguments

  • url_str - A string slice of the URL to extract the filename from.
  • default_filename - The filename to return if none can be extracted from the URL.

§Returns

A String containing the extracted filename or the default filename.