2

Closed

ZipErrorAction.Skip is not honored when using nonseekable output stream, and File.Open fails

description

from http://dotnetzip.codeplex.com/discussions/264298
 
Suppose ZipFile.ZipErrorAction is set to InvokeHandler, When DotNetZip encounters an error opening a file, it invokes the error handler. Suppose that it tells DotNetZIp to skip that entry. In the general case, DotNetZIp needs to seek back in the output stream, to "erase" any output that has already been emitted for that entry. If the output stream is non-seekable, this Seek would fail, therefore DotNetZip throws.
 
However, there is a special case, in which the File.Open fails due to a sharing violation, for example. In that case there is no need to seek backward in the output stream, because no output was sent to the output stream at all.
 
DotNetZip should not try to seek back unless necessary.
 
With that change, DotNetZip will skip the entry if it fails to open, and not try to seek back in the output stream.
 
 
I hope this is clear; ask if not.
Closed Jul 11, 2011 at 11:35 AM by Cheeso
fixed in changeset 80525. The first binary with this change will be v1.9.1.6.

comments

BrianTacker wrote Jul 11, 2011 at 9:21 PM

I just want to let you know I tested it with my code and its working well. Thank you