mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Fixed issue with extractZip function.
This commit is contained in:
parent
f9b9fd23c2
commit
5f7b8465d0
1 changed files with 13 additions and 11 deletions
|
@ -1183,18 +1183,20 @@ def extractZip(archive, targetDir):
|
|||
if not os.path.exists(targetDir):
|
||||
os.mkdir(targetDir)
|
||||
|
||||
with zipfile.ZipFile(archive) as zip_file:
|
||||
for member in zip_file.namelist():
|
||||
filename = os.path.basename(member)
|
||||
# skip directories
|
||||
if not filename:
|
||||
continue
|
||||
zip_file = zipfile.ZipFile(archive, 'r')
|
||||
for member in zip_file.namelist():
|
||||
filename = os.path.basename(member)
|
||||
# skip directories
|
||||
if not filename:
|
||||
continue
|
||||
|
||||
# copy file (taken from zipfile's extract)
|
||||
source = zip_file.open(member)
|
||||
target = file(os.path.join(targetDir, filename), "wb")
|
||||
with source, target:
|
||||
shutil.copyfileobj(source, target)
|
||||
# copy file (taken from zipfile's extract)
|
||||
source = zip_file.open(member)
|
||||
target = file(os.path.join(targetDir, filename), "wb")
|
||||
shutil.copyfileobj(source, target)
|
||||
source.close()
|
||||
target.close()
|
||||
zip_file.close()
|
||||
return True
|
||||
except:
|
||||
return False
|
Loading…
Reference in a new issue