publisher: skip directories when importing from a zipfile (#6787)

This commit is contained in:
Jérôme Schneider 2015-03-20 16:29:12 +01:00 committed by Frédéric Péters
parent 82627cdc8c
commit 23ea72da85
1 changed files with 4 additions and 1 deletions

View File

@ -144,9 +144,12 @@ class WcsPublisher(StubWcsPublisher):
results = {'formdefs': 0, 'workflows': 0, 'categories': 0, 'roles': 0, 'settings': 0}
for f in z.namelist():
path = os.path.join(self.app_dir, f)
data = z.read(f)
if not os.path.exists(os.path.dirname(path)):
os.mkdir(os.path.dirname(path))
if not os.path.basename(f):
# skip directories
continue
data = z.read(f)
if f == 'config.pck':
results['settings'] = 1
d = cPickle.loads(data)