Skip to content

Can't open empty file #879

@MagnusBeijer

Description

@MagnusBeijer

Describe the bug

If a zip file is created without adding any files to it, it can not be opened and throws:
ICSharpCode.SharpZipLib.Zip.ZipException: Cannot find central directory

Steps to reproduce

    using (var b = ZipFile.Create("c:\\temp\\sharpzip.zip")) { }
    using (var b = new ZipFile("c:\\temp\\sharpzip.zip")) { } // Throws exception

Expected behaviour

The file should be opened and contain no files.

Operating System

Windows

Framework Version

.NET 7

Tags

ZIP

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzipRelated to ZIP file format

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions