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

return Stream.Null when 7z entry has no stream #854

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zgabi
Copy link

@zgabi zgabi commented Jul 6, 2024

bug: 7z file extraction fails when the archive contains empty file

I'm using the following code to extract a 7z file:

using var sevenZip = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(data);
sevenZip.WriteToDirectory(root);

But it fails when the archive file (data) contains an empy file.
The same GetCompressedStream method returns Stream.Null, I think this method should also return Stream.Null instead throwing an exception.

It would be good to put an empy file to the tests\TestArchives\Original folder and to all the test files, to cover this case in the tests, but I don't know how to create them.

@adamhathcock
Copy link
Owner

There should be a tested added but can merge just for consistency

@zgabi
Copy link
Author

zgabi commented Jul 9, 2024

Yes. There should be an empty file in the tests\TestArchives\Original folder... but I don't know how to add that to all "exotic" archives in the tests\TestArchives\Archives folder (for example tests\TestArchives\Archives\7Zip.ZSTD.7z). So please add it. Thank you.

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 this pull request may close these issues.

None yet

2 participants