diff --git a/make_repo.py b/make_repo.py index cad71af..03e02c8 100755 --- a/make_repo.py +++ b/make_repo.py @@ -91,9 +91,12 @@ def extract_blinfo(item: Path) -> dict: except zipfile.BadZipFile: # If it's not a valid zip, assume file is just a normal file - # TODO: this probably blows up inelegantly on corrupted zips - with item.open() as f: - blinfo = parse_blinfo(f.read()) + try: + with item.open() as f: + blinfo = parse_blinfo(f.read()) + except: #HACK + # If it's not a zip and its not parse-able python, then it's not an addon + raise BadAddon("File '%s' doesn't appear to be an addon" % item) # This should not happen if blinfo == None: diff --git a/tests/test_helpers/addons/nonzip_nonaddon.tar b/tests/test_helpers/addons/nonzip_nonaddon.tar new file mode 100644 index 0000000..d74e2bd Binary files /dev/null and b/tests/test_helpers/addons/nonzip_nonaddon.tar differ