Skip to content

Commit c5d1cf3

Browse files
bug(launchpad): Ensure mobile artifact's zip structures are preserved
1 parent 05df700 commit c5d1cf3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/commands/mobile_app/upload.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ fn normalize_directory(path: &Path) -> Result<TempFile> {
241241

242242
let mut file_count = 0;
243243

244+
// Get the directory name to preserve in the zip structure
245+
let dir_name = path
246+
.file_name()
247+
.ok_or_else(|| anyhow!("Failed to get directory name"))?
248+
.to_str()
249+
.ok_or_else(|| anyhow!("Directory name is not valid UTF-8"))?;
250+
244251
// Collect and sort entries for deterministic ordering
245252
// This is important to ensure stable sha1 checksums for the zip file as
246253
// an optimization is used to avoid re-uploading the same chunks if they're already on the server.
@@ -252,7 +259,9 @@ fn normalize_directory(path: &Path) -> Result<TempFile> {
252259
.map(|entry| {
253260
let entry_path = entry.into_path();
254261
let relative_path = entry_path.strip_prefix(path)?.to_owned();
255-
Ok((entry_path, relative_path))
262+
// Preserve the directory structure by including the directory name
263+
let full_relative_path = Path::new(dir_name).join(relative_path);
264+
Ok((entry_path, full_relative_path))
256265
})
257266
.collect::<Result<Vec<_>>>()?
258267
.into_iter()

0 commit comments

Comments
 (0)