Skip to content

Commit 07c0b76

Browse files
runningcodeclaude
andcommitted
fix(build): Check xcarchive/IPA extension before ByteView::open
ByteView::open() calls File::open() internally, which fails with a generic I/O error on directories. Since .xcarchive is a directory bundle, the previous validation in validate_is_supported_build() was unreachable — users on non-Apple Silicon got a confusing "Is a directory" error instead of the intended helpful message. Move the extension check before ByteView::open() so the clear error message is shown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 805ed87 commit 07c0b76

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/commands/build/upload.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,20 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
209209
return Err(anyhow!("Path does not exist: {}", path.display()));
210210
}
211211

212+
// On non-Apple Silicon, reject xcarchive/IPA early before trying to
213+
// open the path as a file (xcarchive is a directory, so ByteView::open
214+
// would fail with a confusing I/O error).
215+
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
216+
{
217+
let ext = path.extension().and_then(|e| e.to_str()).unwrap_or("");
218+
if ext.eq_ignore_ascii_case("xcarchive") || ext.eq_ignore_ascii_case("ipa") {
219+
return Err(anyhow!(
220+
"Uploading XCArchive and IPA files requires an Apple Silicon Mac: {}",
221+
path.display()
222+
));
223+
}
224+
}
225+
212226
let byteview = ByteView::open(path)?;
213227
debug!("Loaded file with {} bytes", byteview.len());
214228

@@ -543,17 +557,6 @@ fn validate_is_supported_build(path: &Path, bytes: &[u8]) -> Result<()> {
543557

544558
debug!("File format validation failed");
545559

546-
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]
547-
{
548-
let ext = path.extension().and_then(|e| e.to_str()).unwrap_or("");
549-
if ext.eq_ignore_ascii_case("xcarchive") || ext.eq_ignore_ascii_case("ipa") {
550-
return Err(anyhow!(
551-
"Uploading XCArchive and IPA files requires an Apple Silicon Mac: {}",
552-
path.display()
553-
));
554-
}
555-
}
556-
557560
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
558561
let format_list = "APK, AAB, XCArchive, or IPA";
559562
#[cfg(not(all(target_os = "macos", target_arch = "aarch64")))]

0 commit comments

Comments
 (0)