File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,13 @@ fn normalize_directory(path: &Path) -> Result<TempFile> {
242242
243243 let mut file_count = 0 ;
244244
245+ // Get the directory name to preserve in the zip structure
246+ let dir_name = path
247+ . file_name ( )
248+ . ok_or_else ( || anyhow ! ( "Failed to get directory name" ) ) ?
249+ . to_str ( )
250+ . ok_or_else ( || anyhow ! ( "Directory name is not valid UTF-8" ) ) ?;
251+
245252 // Collect and sort entries for deterministic ordering
246253 // This is important to ensure stable sha1 checksums for the zip file as
247254 // an optimization is used to avoid re-uploading the same chunks if they're already on the server.
@@ -253,7 +260,9 @@ fn normalize_directory(path: &Path) -> Result<TempFile> {
253260 . map ( |entry| {
254261 let entry_path = entry. into_path ( ) ;
255262 let relative_path = entry_path. strip_prefix ( path) ?. to_owned ( ) ;
256- Ok ( ( entry_path, relative_path) )
263+ // Preserve the directory structure by including the directory name
264+ let full_relative_path = Path :: new ( dir_name) . join ( relative_path) ;
265+ Ok ( ( entry_path, full_relative_path) )
257266 } )
258267 . collect :: < Result < Vec < _ > > > ( ) ?
259268 . into_iter ( )
You can’t perform that action at this time.
0 commit comments