@@ -1177,7 +1177,7 @@ async fn write_ereport(ereport: Ereport, dir: &Utf8Path) -> anyhow::Result<()> {
11771177 // Nexus doesn't have full control over --- it came from the ereport
11781178 // metadata --- we must check that it doesn't contain any characters
11791179 // unsuitable for use in a filesystem path.
1180- let pn = ereport
1180+ let pn = ereport. data
11811181 . part_number
11821182 . as_deref ( )
11831183 // If the part or serial numbers contain any unsavoury characters, it
@@ -1187,24 +1187,25 @@ async fn write_ereport(ereport: Ereport, dir: &Utf8Path) -> anyhow::Result<()> {
11871187 // giving up on using it in the path.
11881188 . filter ( |& s| is_fs_safe_single_path_component ( s) )
11891189 . unwrap_or ( "unknown_part" ) ;
1190- let sn = ereport
1190+ let sn = ereport. data
11911191 . serial_number
11921192 . as_deref ( )
11931193 . filter ( |& s| is_fs_safe_single_path_component ( s) )
11941194 . unwrap_or ( "unknown_serial" ) ;
1195-
1195+ let id = & ereport. data . id ;
1196+
11961197 let dir = dir
11971198 . join ( format ! ( "{pn}-{sn}" ) )
11981199 // N.B. that we call `into_untyped_uuid()` here, as the `Display`
11991200 // implementation for a typed UUID appends " (ereporter_restart)", which
12001201 // we don't want.
1201- . join ( ereport . id ( ) . restart_id . into_untyped_uuid ( ) . to_string ( ) ) ;
1202+ . join ( id . restart_id . into_untyped_uuid ( ) . to_string ( ) ) ;
12021203 tokio:: fs:: create_dir_all ( & dir)
12031204 . await
12041205 . with_context ( || format ! ( "failed to create directory '{dir}'" ) ) ?;
1205- let file_path = dir. join ( format ! ( "{}.json" , ereport . id. ena) ) ;
1206+ let file_path = dir. join ( format ! ( "{}.json" , id. ena) ) ;
12061207 let json = serde_json:: to_vec ( & ereport) . with_context ( || {
1207- format ! ( "failed to serialize ereport {pn}:{sn}/{}" , ereport . id )
1208+ format ! ( "failed to serialize ereport {pn}:{sn}/{id}" )
12081209 } ) ?;
12091210 tokio:: fs:: write ( & file_path, json)
12101211 . await
0 commit comments