Zip file ArchiveFactory.Open throws exception for Legacy compressed zip file #505

Closed
opened 2026-01-29 22:13:01 +00:00 by claunia · 2 comments
Owner

Originally created by @Malshan90 on GitHub (Mar 3, 2022).

Hi,

The zip file I'm using use Zip 2.0 (Legacy) compression. When I try to open it via ArchiveFactory.Open, I get below exception,
"Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip"
I'm using ArchiveFactory Open(string filePath, ReaderOptions? options = null) method. All AES encrypted file can be open and extract without any issues.

Could you guide me here, This is the first time we got Legacy files from a client. Thing is we do need to support legacy method in our system as any new client can be sending legacy compressed files.

Thanks in Advance.

Originally created by @Malshan90 on GitHub (Mar 3, 2022). Hi, The zip file I'm using use Zip 2.0 (Legacy) compression. When I try to open it via ArchiveFactory.Open, I get below exception, **"Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip"** I'm using ArchiveFactory Open(string filePath, ReaderOptions? options = null) method. All AES encrypted file can be open and extract without any issues. Could you guide me here, This is the first time we got Legacy files from a client. Thing is we do need to support legacy method in our system as any new client can be sending legacy compressed files. Thanks in Advance.
Author
Owner

@adamhathcock commented on GitHub (Mar 3, 2022):

This would need investigating what Magic Bytes are in the file that are unmatched to what SharpCompress knows about.

Do they work if you use ZipArchive.Open directly?

@adamhathcock commented on GitHub (Mar 3, 2022): This would need investigating what Magic Bytes are in the file that are unmatched to what SharpCompress knows about. Do they work if you use ZipArchive.Open directly?
Author
Owner

@Malshan90 commented on GitHub (Mar 3, 2022):

Sorry, I found the issue and that was our engineer has used an iteration and instead of directly sending the zip file he's been sending bunch of other files as well. I just reviewed the code and removed the buggy code.
It works perfectly.
Sorry to bother you.
Keep it up the good work.!

@Malshan90 commented on GitHub (Mar 3, 2022): Sorry, I found the issue and that was our engineer has used an iteration and instead of directly sending the zip file he's been sending bunch of other files as well. I just reviewed the code and removed the buggy code. It works perfectly. Sorry to bother you. Keep it up the good work.!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#505