Skip to content

Commit b3b0846

Browse files
committed
ENH: Safeguard zip extraction in try/except
1 parent f9774ae commit b3b0846

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

templateflow/conf/_s3.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ def _update_skeleton(skel_file, dest, overwrite=True, silent=False):
9999
)
100100
for fl in newfiles:
101101
localpath = dest / fl
102-
if localpath.is_dir(): # avoid extracting existing directories
102+
if localpath.exists():
103103
continue
104-
zipref.extract(fl, path=dest)
104+
try:
105+
zipref.extract(fl, path=dest)
106+
except FileExistsError:
107+
# If there is a conflict, do not clobber
108+
pass
105109
return True
106110
if not silent:
107111
print('TEMPLATEFLOW_HOME directory (S3 type) was up-to-date.')

0 commit comments

Comments
 (0)