@@ -8,8 +8,8 @@ use clap::{Arg, ArgMatches, Command};
88use console:: style;
99use log:: { debug, info, warn} ;
1010use objectstore_client:: { ClientBuilder , ExpirationPolicy , Usecase } ;
11- use sha2:: { Digest as _, Sha256 } ;
1211use secrecy:: ExposeSecret as _;
12+ use sha2:: { Digest as _, Sha256 } ;
1313use walkdir:: WalkDir ;
1414
1515use crate :: api:: { Api , CreateSnapshotResponse , ImageMetadata , SnapshotsManifest } ;
@@ -47,7 +47,7 @@ pub fn make_command(command: Command) -> Command {
4747
4848struct ImageInfo {
4949 path : std:: path:: PathBuf ,
50- relative_path : String ,
50+ relative_path : std :: path :: PathBuf ,
5151 width : u32 ,
5252 height : u32 ,
5353}
@@ -156,11 +156,7 @@ fn collect_image_info(dir: &Path, path: &Path) -> Option<ImageInfo> {
156156 return None ;
157157 }
158158 } ;
159- let relative = path
160- . strip_prefix ( dir)
161- . unwrap_or ( path)
162- . to_string_lossy ( )
163- . to_string ( ) ;
159+ let relative = path. strip_prefix ( dir) . unwrap_or ( path) . to_path_buf ( ) ;
164160
165161 Some ( ImageInfo {
166162 path : path. to_path_buf ( ) ,
@@ -235,7 +231,7 @@ fn upload_images(
235231 . with_context ( || format ! ( "Failed to read image: {}" , image. path. display( ) ) ) ?;
236232 let hash = compute_sha256_hash ( & contents) ;
237233
238- info ! ( "Queueing {} as {hash}" , image. relative_path) ;
234+ info ! ( "Queueing {} as {hash}" , image. relative_path. display ( ) ) ;
239235
240236 many_builder = many_builder. push (
241237 session
@@ -244,7 +240,8 @@ fn upload_images(
244240 . expiration_policy ( expiration) ,
245241 ) ;
246242
247- let image_file_name = Path :: new ( & image. relative_path )
243+ let image_file_name = image
244+ . relative_path
248245 . file_name ( )
249246 . unwrap_or_default ( )
250247 . to_string_lossy ( )
0 commit comments