Skip to content

Commit

Permalink
[fix] SQLiteIndexedTar: Close opened file object before raising an ex…
Browse files Browse the repository at this point in the history
…ception
  • Loading branch information
mxmlnkn committed Feb 20, 2024
1 parent ae04adc commit 627f047
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/ratarmountcore/SQLiteIndexedTar.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,10 @@ def __init__(
printDebug=self.printDebug,
)
if not self.isTar and not self.rawFileObject:
raise RatarmountError("File object (" + str(fileObject) + ") could not be opened as a TAR file!")
fileObjectInfo = str(fileObject)
if not self.isFileObject:
fileObject.close()
raise RatarmountError(f"File object ({fileObjectInfo}) could not be opened as a TAR file!")

self.fileObjectLock = threading.Lock()

Expand Down

0 comments on commit 627f047

Please sign in to comment.