@@ -114,8 +114,7 @@ impl Image {
114114 let hda = resolve_optional_artifact ( & base_path, info. hda . as_deref ( ) , "Hda" ) ?;
115115 let rootfs = resolve_optional_artifact ( & base_path, info. rootfs . as_deref ( ) , "Rootfs" ) ?;
116116 let bios = resolve_optional_artifact ( & base_path, info. bios . as_deref ( ) , "Bios" ) ?;
117- let bios_sev =
118- resolve_optional_artifact ( & base_path, info. bios_sev . as_deref ( ) , "SEV bios" ) ?;
117+ let bios_sev = resolve_optional_artifact ( & base_path, info. bios_sev . as_deref ( ) , "SEV bios" ) ?;
119118 let digest = fs:: read_to_string ( base_path. join ( "digest.txt" ) )
120119 . ok ( )
121120 . map ( |s| s. trim ( ) . to_string ( ) ) ;
@@ -226,7 +225,8 @@ impl Image {
226225
227226fn resolve_artifact ( base_path : & Path , value : & str , label : & str ) -> Result < PathBuf > {
228227 let candidate = base_path. join ( value) ;
229- let resolved = candidate. canonicalize ( )
228+ let resolved = candidate
229+ . canonicalize ( )
230230 . with_context ( || format ! ( "{label} does not exist: {}" , candidate. display( ) ) ) ?;
231231 if !resolved. starts_with ( base_path) {
232232 bail ! ( "{label} escapes image directory: {}" , candidate. display( ) ) ;
@@ -237,8 +237,14 @@ fn resolve_artifact(base_path: &Path, value: &str, label: &str) -> Result<PathBu
237237 Ok ( resolved)
238238}
239239
240- fn resolve_optional_artifact ( base_path : & Path , value : Option < & str > , label : & str ) -> Result < Option < PathBuf > > {
241- value. map ( |value| resolve_artifact ( base_path, value, label) ) . transpose ( )
240+ fn resolve_optional_artifact (
241+ base_path : & Path ,
242+ value : Option < & str > ,
243+ label : & str ,
244+ ) -> Result < Option < PathBuf > > {
245+ value
246+ . map ( |value| resolve_artifact ( base_path, value, label) )
247+ . transpose ( )
242248}
243249
244250fn load_measurement_document < T > (
@@ -272,7 +278,6 @@ fn guess_version(base_path: &Path) -> Option<String> {
272278 Some ( version. to_string ( ) )
273279}
274280
275-
276281#[ cfg( test) ]
277282mod tests {
278283 use super :: { Image , ImageInfo } ;
0 commit comments