pub fn redact_known_secrets_from_url(url: &Url, redaction: &str) -> Option<Url>
Expand description

Anaconda channels are not always publicly available. This function checks if a URL contains a secret by identifying whether it contains certain patterns. If it does, the function returns a modified URL where any secret has been masked.

The redaction argument can be used to specify a custom string that should be used to replace a secret. For consistency between application it is recommended to pass DEFAULT_REDACTION_STR.

Example


let url = Url::parse("https://conda.anaconda.org/t/12345677/conda-forge/noarch/repodata.json").unwrap();
let redacted_url = redact_known_secrets_from_url(&url, DEFAULT_REDACTION_STR).unwrap_or(url);