Skip to content

archive/zip: FileInfoHeader does not handle directories #24082

Description

@dsnet

Consider the following:

fi, _ := os.Stat("/home/")
h, _ := zip.FileInfoHeader(fi)
fmt.Println(h.Name)

This currently prints:

home

However, ZIP treats directories as files with a trailing "/" in the name, which FileInfoHeader should automatically append if os.FileInfo.IsDir reports true.

This difference is minor since users are usually expected to replace the FileHeader.Name shortly afterwards anyways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.early-in-cycleA change that should be done early in the 3 month dev cycle.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions