Lecrapouille/zipper

0 sized files extracted as directories.

fbergmann opened this issue · 4 comments

When zipper extracts an archive containing files of size 0, they will be extracted as directories rather than 0 sized files. This was first filed here:

sbmlteam/libCombine#59

where there is also a test archive showing the issue.

While the zipper version we use is quite old, the issue persists in the current code base, where in:

https://github.com/Lecrapouille/zipper/blob/master/src/Unzipper.cpp#L210

we have:

      if (!entryinfo.uncompressedSize)
        {
            if (!Path::createDir(fileName))
            {
                std::stringstream str;
                str << "Error cannot create folder '" << fileName << "'";
                m_error_code = make_error_code(
                    unzipper_error::INTERNAL_ERROR, str.str());
                err = UNZ_ERRNO;
            }
        }

@fbergmann Welcome back from other repo ^^ I'll check that

@fbergmann done. Reopen this ticket if your find other cases

I fixed it similarly in the old fork:

fbergmann/zipper@c56a27f

@fbergmann I saw it and that what I saw Java people also did. I dunno why they just check the last '/' (Unix) char but not for '\' (Win) and your/their/mine code may be not robust to 'escaped' backslash (while Unix does not like creating file with '/' char). Zip documentation is poor.