diff --git a/_modules/parsedmarc.html b/_modules/parsedmarc.html index b2ac8f2e..8c695163 100644 --- a/_modules/parsedmarc.html +++ b/_modules/parsedmarc.html @@ -963,9 +963,7 @@ try: file_object = BytesIO(b64decode(content)) except binascii.Error: - pass - if file_object is None: - file_object = open(content, "rb") + return content elif type(content) is bytes: file_object = BytesIO(content) else: @@ -989,10 +987,12 @@ file_object.close() except UnicodeDecodeError: - file_object.close() + if file_object: + file_object.close() raise ParserError("File objects must be opened in binary (rb) mode") except Exception as error: - file_object.close() + if file_object: + file_object.close() raise ParserError("Invalid archive file: {0}".format(error.__str__())) return report