EPUB Output: Ensure directories have the correct permissions bits set when unzipping an epub with unzip on Unix

This commit is contained in:
Kovid Goyal 2011-12-20 16:21:30 +05:30
parent a05dfa8d90
commit a43026fee1
2 changed files with 2 additions and 4 deletions

View File

@ -35,7 +35,7 @@ def initialize_container(path_to_container, opf_name='metadata.opf',
'''.format(opf_name, extra_entries=rootfiles).encode('utf-8')
zf = ZipFile(path_to_container, 'w')
zf.writestr('mimetype', 'application/epub+zip', compression=ZIP_STORED)
zf.writestr('META-INF/', '', 0700)
zf.writestr('META-INF/', '', 0755)
zf.writestr('META-INF/container.xml', CONTAINER)
for path, _, data in extra_entries:
zf.writestr(path, data)

View File

@ -1297,9 +1297,7 @@ class ZipFile:
Add a directory recursively to the zip file with an optional prefix.
'''
if prefix:
zi = ZipInfo(prefix+'/')
zi.external_attr = 16
self.writestr(zi, '')
self.writestr(prefix+'/', '', 0755)
cwd = os.path.abspath(os.getcwd())
try:
os.chdir(path)