zipunzip

Is it possible that a zip entry has no name?


When i receive a zip file, is it possible at least in theory, that an entry in the zip file has no name?

I know it is possible that zip entries have duplicate names, or whitespace names. But can the name just be empty while the content is not?


Solution

  • Yes, a zip file is allowed by the spec to have a file name length of zero. Depending on your interpretation that either means "no file name" or that the file name is the empty string.

    The spec explicitly mentions that

    If input came from standard input, the file name length is set to zero.