Unable to unZIP file #387

Closed
opened 2026-01-29 22:11:06 +00:00 by claunia · 6 comments
Owner

Originally created by @MikhaelBolgov on GitHub (Feb 17, 2020).

Hello,

It seems, that SharpCompress is unable to correctly unpack files from this ZIP file:
https://download.print-driver.com/ex/mb/SharpCompress/20-00010.zip

7z & WinRAR are able to unpack this ZIP file with ease. So, could you please fix this issue in new SharpCompress build?

My code snippet is below. Please let me know if you need any additional info to debug this issue.

namespace ConsoleApp1 {
class Program {
static void Main(string[] args) {
Extract(@"c:\out\20-00010.zip", "830483 Taxes.pdf");
}

    static void Extract(string filepath, string entryName) {
        IArchive archive = null;
        try {
            archive = ArchiveFactory.Open(filepath);
            var entry = archive.Entries.FirstOrDefault(e => !e.IsDirectory && entryName == e.Key);
            if (entry != default(IArchiveEntry)) {
                entry.WriteToFile(@"c:\out\xxx.pdf", new ExtractionOptions() { ExtractFullPath = false, Overwrite = true });
            }
        } catch {
        } finally {
            archive?.Dispose();
        }
    }
}

}

Mikhael

Originally created by @MikhaelBolgov on GitHub (Feb 17, 2020). Hello, It seems, that SharpCompress is unable to correctly unpack files from this ZIP file: https://download.print-driver.com/ex/mb/SharpCompress/20-00010.zip 7z & WinRAR are able to unpack this ZIP file with ease. So, could you please fix this issue in new SharpCompress build? My code snippet is below. Please let me know if you need any additional info to debug this issue. --- namespace ConsoleApp1 { class Program { static void Main(string[] args) { Extract(@"c:\out\20-00010.zip", "830483 Taxes.pdf"); } static void Extract(string filepath, string entryName) { IArchive archive = null; try { archive = ArchiveFactory.Open(filepath); var entry = archive.Entries.FirstOrDefault(e => !e.IsDirectory && entryName == e.Key); if (entry != default(IArchiveEntry)) { entry.WriteToFile(@"c:\out\xxx.pdf", new ExtractionOptions() { ExtractFullPath = false, Overwrite = true }); } } catch { } finally { archive?.Dispose(); } } } } --- Mikhael
Author
Owner

@Erior commented on GitHub (Apr 22, 2020):

I tested this on Windows with your file/code without issue, what kind of problem did you get?

@Erior commented on GitHub (Apr 22, 2020): I tested this on Windows with your file/code without issue, what kind of problem did you get?
Author
Owner

@MikhaelBolgov commented on GitHub (Apr 23, 2020):

If we unpack "830483 Taxes.pdf" file from "20-00010.zip", the output file size have wrong size.
Correct size is: 769676 bytes. But extracted by sharpcompress file size is 8053096 bytes.

If I open extracted file "830483 Taxes.pdf" in Notepad, I can see, that this file contains correct PDF file content + "extra ending" with a lot of digital data.

Please let me know if you need any additional data to reproduce this issue on your side.

Mikhael

@MikhaelBolgov commented on GitHub (Apr 23, 2020): If we unpack "830483 Taxes.pdf" file from "20-00010.zip", the output file size have wrong size. Correct size is: 769676 bytes. But extracted by sharpcompress file size is 8053096 bytes. If I open extracted file "830483 Taxes.pdf" in Notepad, I can see, that this file contains correct PDF file content + "extra ending" with a lot of digital data. Please let me know if you need any additional data to reproduce this issue on your side. Mikhael
Author
Owner

@adamhathcock commented on GitHub (Apr 23, 2020):

Did you use the latest version?

Thanks for helping @Erior

@adamhathcock commented on GitHub (Apr 23, 2020): Did you use the latest version? Thanks for helping @Erior
Author
Owner

@MikhaelBolgov commented on GitHub (Apr 23, 2020):

Yes, the newest version works well, thank you!

It seems, that we are able to build your solution under NET Framework 4.6 only. Do you have any idea how to build newest version of sharpcompress DLL under NET Framework 4.0 to let it work under all Windows versions our customers have?

@MikhaelBolgov commented on GitHub (Apr 23, 2020): Yes, the newest version works well, thank you! It seems, that we are able to build your solution under NET Framework 4.6 only. Do you have any idea how to build newest version of sharpcompress DLL under NET Framework 4.0 to let it work under all Windows versions our customers have?
Author
Owner

@adamhathcock commented on GitHub (Apr 23, 2020):

You should only use supported versions of the .NET Framework or use .NET Core. I'm personally not wanting to build for full framework anymore and probably won't want .NET 5 is out.

You're welcome to get the source and build it yourself if you need other types of support.

@adamhathcock commented on GitHub (Apr 23, 2020): You should only use supported versions of the .NET Framework or use .NET Core. I'm personally not wanting to build for full framework anymore and probably won't want .NET 5 is out. You're welcome to get the source and build it yourself if you need other types of support.
Author
Owner

@MikhaelBolgov commented on GitHub (Apr 23, 2020):

OK, I see. Thank you for your component!

@MikhaelBolgov commented on GitHub (Apr 23, 2020): OK, I see. Thank you for your component!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#387