fix: error if IPA structure is missing Payload root
This commit is contained in:
@@ -417,9 +417,11 @@ def loadIpa(uid: int, url: str, *,
|
|||||||
app_name = None
|
app_name = None
|
||||||
artwork = False
|
artwork = False
|
||||||
zip_listing = zip.infolist()
|
zip_listing = zip.infolist()
|
||||||
|
has_payload_folder = False
|
||||||
|
|
||||||
for entry in zip_listing:
|
for entry in zip_listing:
|
||||||
fn = entry.filename.lstrip('/')
|
fn = entry.filename.lstrip('/')
|
||||||
|
has_payload_folder |= fn.startswith('Payload/')
|
||||||
plist_match = re_info_plist.match(fn)
|
plist_match = re_info_plist.match(fn)
|
||||||
if fn == 'iTunesArtwork':
|
if fn == 'iTunesArtwork':
|
||||||
extractZipEntry(zip, entry, img_path)
|
extractZipEntry(zip, entry, img_path)
|
||||||
@@ -429,6 +431,10 @@ def loadIpa(uid: int, url: str, *,
|
|||||||
if not image_only:
|
if not image_only:
|
||||||
extractZipEntry(zip, entry, plist_path)
|
extractZipEntry(zip, entry, plist_path)
|
||||||
|
|
||||||
|
if not has_payload_folder:
|
||||||
|
print(f'ERROR: [{uid}] ipa has no "Payload/" root folder',
|
||||||
|
file=stderr)
|
||||||
|
|
||||||
# if no iTunesArtwork found, load file referenced in plist
|
# if no iTunesArtwork found, load file referenced in plist
|
||||||
if not artwork and app_name and plist_path.exists():
|
if not artwork and app_name and plist_path.exists():
|
||||||
with open(plist_path, 'rb') as fp:
|
with open(plist_path, 'rb') as fp:
|
||||||
|
|||||||
Reference in New Issue
Block a user