Skip to content
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

ZipOuputStream does not support writing custom entries #682

Closed
Temtaime opened this issue Oct 28, 2021 · 5 comments · Fixed by #683
Closed

ZipOuputStream does not support writing custom entries #682

Temtaime opened this issue Oct 28, 2021 · 5 comments · Fixed by #683

Comments

@Temtaime
Copy link
Contributor

Steps to reproduce

  1. Create ZipEntry and set Crc, CompressedSize, Size and CompressionMethod(Deflate).
  2. Try to write deflated stream to zip.

Expected behavior

Archive is created from compressed data.

Actual behavior

There are plently of checks for crc/size/compressed size and many of them are wrong for such a case, also library tries to compress futher compressed stream.

Version of SharpZipLib

Latest

@Temtaime
Copy link
Contributor Author

Temtaime commented Oct 28, 2021

I'll try to propose a PR in days, seems there's not so much to fix

Temtaime added a commit to Temtaime/SharpZipLib that referenced this issue Nov 2, 2021
@piksel piksel changed the title Enable ZipOuputStream to write precompressed files ZipOuputStream does not support writing custom entries Nov 2, 2021
@piksel piksel linked a pull request Nov 2, 2021 that will close this issue
@piksel
Copy link
Member

piksel commented Nov 2, 2021

This is not how ZipOutputStream is designed to work. Do you have a specific use case?
Adding a new state and custom logic for this adds to the complexity and maintenance cost, and would need to be fully covered by tests...

@Temtaime
Copy link
Contributor Author

Temtaime commented Nov 2, 2021

Ok, i'll add some tests.
It can be used to serve files from webserver that are stored already precompressed to avoid CPU resources on compression

@piksel
Copy link
Member

piksel commented Nov 2, 2021

Okay, so for combining a variable set of files into a single download by creating a ZIP archive on-the-fly?

@Temtaime
Copy link
Contributor Author

Temtaime commented Nov 2, 2021

Exactly, i was using my own solution, but found this library with rich functional and figured out that adding this possibility into existing codebase should not be a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants