archive: Fix TypeError when adding an empty dir to ZIP archives

Fixes archivetest.
This commit is contained in:
Fatih Aşıcı
2010-07-12 13:18:04 +00:00
parent 3927ad3173
commit 774974c13d
+1
View File
@@ -448,6 +448,7 @@ class ArchiveZip(ArchiveBase):
# It's a pity that zipfile can't handle unicode strings. Grrr!
file_name = str(file_name)
if os.path.isdir(file_name) and not os.path.islink(file_name):
arc_name = arc_name or ""
self.zip_obj.writestr(arc_name + '/', '')
attr_obj = self.zip_obj.getinfo(arc_name + '/')
attr_obj.external_attr = stat.S_IMODE(os.stat(file_name)[0]) << 16L