Closed bmulholland closed 1 year ago
This will help with issues like https://github.com/ruby-docx/docx/issues/100
Done and done :)
Thanks @bmulholland, this looks like a good change. I ran into this error when using this library for the first time when I didn't have my path correct. So I think this PR would result in a clearer error message.
@satoryu Would love to get this into the repo so we can stop maintaining our custom fork. If I resolve the conflicts now, would you merge it?
@bmulholland yes!
Oh, well, looks like another, more recent PR was merged that did the same thing...
When an invalid file is passed in and the Zip library throws an error, @zip is not set. Then the ensure runs and tries to close the zip var, which is nil. This raises a new error that covers up the actual error, making the issue harder to investigate. By only closing the zip file if it was actually opened, the original error is raised for invalid docx files.