Skip to content

Commit e6428dc

Browse files
NicoHinderlingrunningcodeclaude
authored
chore(preprod): Improve error messaging for zip normalizing step in case of duplicate filename case (#2864)
If a user hits this case, they will have more context for what's going wrong --------- Co-authored-by: Nelson Osacky <nelson.osacky@sentry.io> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 64ca848 commit e6428dc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils/build/normalize.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::os::unix::fs::PermissionsExt as _;
77
use std::path::{Path, PathBuf};
88

99
use crate::utils::fs::TempFile;
10-
use anyhow::Result;
10+
use anyhow::{Context as _, Result};
1111
use itertools::Itertools as _;
1212
use log::debug;
1313
use symbolic::common::ByteView;
@@ -61,10 +61,12 @@ fn add_entries_to_zip(
6161
let target_str = target.to_string_lossy();
6262

6363
// Create a symlink entry in the zip
64-
zip.add_symlink(zip_path, &target_str, options)?;
64+
zip.add_symlink(zip_path.as_str(), &target_str, options)
65+
.with_context(|| format!("Failed to add symlink '{zip_path}' to zip archive"))?;
6566
} else {
6667
// Handle regular files
67-
zip.start_file(zip_path, options)?;
68+
zip.start_file(zip_path.as_str(), options)
69+
.with_context(|| format!("Failed to add file '{zip_path}' to zip archive"))?;
6870
let file_byteview = ByteView::open(&entry_path)?;
6971
zip.write_all(file_byteview.as_slice())?;
7072
}

0 commit comments

Comments
 (0)