mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make extracting zipfiles more resilient against invalid characters in filenames
The previous check applied to actual files but not directories
This commit is contained in:
parent
c14c232b33
commit
72b3993fca
@ -1155,7 +1155,11 @@ class ZipFile:
|
||||
|
||||
if member.filename[-1] == '/':
|
||||
if not os.path.isdir(targetpath):
|
||||
os.mkdir(targetpath)
|
||||
try:
|
||||
os.mkdir(targetpath)
|
||||
except Exception: # Added by Kovid
|
||||
targetpath = os.path.join(base_target, sanitize_file_name(fname))
|
||||
os.mkdir(targetpath)
|
||||
self.extract_mapping[member.filename] = targetpath
|
||||
return targetpath
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user