jgm/zip-archive

Safe operations for Entry values

Opened this issue · 1 comments

I think it would be useful to be able to modify Entry safely. I need to read all the entries out of an archive and change the pathnames. Currently I'm doing this with eRelativePath, but that seems to be unsafe, since the library internally uses the trailing "/" as a marker for directories.

This is important in my use case, because I am using OptRecursive to add a directory full of files, and then trimming all the paths in the entries. When using OptRecursive with addaddEntryToArchive on a directory, the directory is given an entry in the archive of its own. During my path trimming, the trailing slash happens to be eliminated, which -- as far as the library is concerned -- turns the directory entry into a file entry. Then, when I write out the archive, I end up with a blank file with the same path and filename as the directory.

jgm commented

I had to revert this change because of problems it caused.