metadata_url_for_snapshot_url

Function metadata_url_for_snapshot_url 

Source
pub(super) fn metadata_url_for_snapshot_url(
    snapshot_url: &str,
) -> Result<String>
Expand description

Derives the metadata URL for a snapshot download URL.

The function parses snapshot_url, keeps the original scheme and host, and replaces the final path segment with metadata.json. For example, https://cdn.example.invalid/releases/catalog.db.zst becomes https://cdn.example.invalid/releases/metadata.json.

An error is returned when the input is not a valid URL or when the URL does not contain a non-empty final path segment to replace.