(digest: &str)
| 4300 | } |
| 4301 | |
| 4302 | fn sha256_digest_hex(digest: &str) -> Result<&str, String> { |
| 4303 | let Some((algorithm, hex)) = digest.split_once(':') else { |
| 4304 | return Err(format!("digest '{digest}' is missing an algorithm")); |
| 4305 | }; |
| 4306 | if algorithm != "sha256" { |
| 4307 | return Err(format!("unsupported digest algorithm '{algorithm}'")); |
| 4308 | } |
| 4309 | if hex.is_empty() || !hex.chars().all(|ch| ch.is_ascii_hexdigit()) { |
| 4310 | return Err(format!("digest '{digest}' is not a valid sha256 digest")); |
| 4311 | } |
| 4312 | Ok(hex) |
| 4313 | } |
| 4314 | |
| 4315 | fn write_oci_layout_for_manifest( |
| 4316 | layout_dir: &Path, |
no test coverage detected