-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InputStream implementation doesn't allow check for encryption beforehand #359
Comments
This is a good point. A couple of options I see are (please ignore if the following doesn't make sense. This is also for my reference when I look at this issue in the future) :
|
Hi, sorry for the long delay. I've created a PR. I hope it will make it clearer for you about what callback I've been talking about. |
@bio007 Thanks for the PR. I appreciate that. I just merged it and will include it in the next release. |
PR included in v2.9.1 released today. |
Using
InputStream
to extract files, which I don't know whether they are password protected or not beforehand, doesn't allow to check for encryption before extraction.Right now you need to call
setPassword
or provide password via constructor before callinggetNextEntry()
which is not always possible. On the other hand callingheaderReader.readLocalFileHeader()
to obtainLocalFileHeader
is possible without password and thereisEncrypted()
can be checked.Unfortunately
getNextEntry()
doesn't execute some "password callback" in case this is detected but tries to extract right away after obtainingLocalFileHeader
.Calling
headerReader.readLocalFileHeader()
first and thengetNextEntry()
causes skipping of files becauseheaderReader.readLocalFileHeader()
moves the position in the stream of course.To solve this please provide something like "password callback" setter which will be executed if no password was provided and file is encrypted.
The text was updated successfully, but these errors were encountered: