Close file object before raising exception

Hopefully resolves #321
This commit is contained in:
Sean Whalen
2022-05-16 22:00:25 -04:00
parent 9d05fe776a
commit 6354c9bce7

View File

@@ -390,9 +390,11 @@ def extract_xml(input_):
file_object.close()
except UnicodeDecodeError:
file_object.close()
raise InvalidAggregateReport("File objects must be opened in binary "
"(rb) mode")
except Exception as error:
file_object.close()
raise InvalidAggregateReport(
"Invalid archive file: {0}".format(error.__str__()))