Skip to main content

sanitize_digest

Function sanitize_digest 

Source
pub fn sanitize_digest(digest: &str) -> String
Expand description

Sanitize an OCI digest into a single, filesystem-safe path component.

Replaces : and / with _ so a digest like sha256:abcd… becomes sha256_abcd…. This MUST stay byte-identical to blob_staging_filename in zlayer-registry’s client.rs (digest.replace([':', '/'], "_")) — that function names the staged compressed-layer blob, and the overlay layer-store keys layers by the SAME sanitized compressed digest so the on-disk staging filename and the layer-store directory name line up. The rule is duplicated rather than shared because zlayer-paths is a leaf crate that zlayer-registry depends on (not vice-versa); keep the two in lockstep if either ever changes.