brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
400 stars 140 forks source link

fix: correctly close files when there is an error during extraction #338

Closed fjulian-epack closed 3 months ago

fjulian-epack commented 4 months ago

In some cases it is possible to have an error during extraction (incorrect archive file, IO issues, ...), but current code never closes the file/inputstream, leading to some potential issues (especially on windows where the file can be locked).

This PR ensures the file/streams are always closed in a finally block.