Skip to content

Commit 0b088cb

Browse files
Update src/utils/mobile_app/validation.rs
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
1 parent b9cf3ed commit 0b088cb

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/utils/mobile_app/validation.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,11 @@ pub fn is_ipa_file(bytes: &[u8]) -> Result<bool> {
4141
let cursor = std::io::Cursor::new(bytes);
4242
let mut archive = zip::ZipArchive::new(cursor)?;
4343

44-
// IPA files must contain a Payload/ directory with a .app bundle inside
45-
let mut has_payload = false;
46-
let mut has_app_in_payload = false;
47-
48-
for i in 0..archive.len() {
49-
let file = archive.by_index(i)?;
50-
let name = file.name();
51-
52-
if name.starts_with("Payload/") {
53-
has_payload = true;
54-
55-
// Check if there's a .app directory in Payload/
56-
if name.starts_with("Payload/") && name.ends_with(".app/") {
57-
has_app_in_payload = true;
58-
break;
59-
}
60-
}
61-
}
44+
let is_ipa = archive
45+
.file_names()
46+
.any(|name| name.starts_with("Payload/") && name.ends_with(".app/"));
6247

63-
Ok(has_payload && has_app_in_payload)
48+
Ok(is_ipa)
6449
}
6550

6651
pub fn is_xcarchive_directory<P>(path: P) -> bool

0 commit comments

Comments
 (0)