Skip to content

Commit

Permalink
Possible fix for 358.
Browse files Browse the repository at this point in the history
  • Loading branch information
sn0b4ll committed Feb 28, 2017
1 parent a1701dd commit 996bc85
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions StaticAnalyzer/views/shared_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,8 @@ def Unzip(APP_PATH, EXT_PATH):
files = []
with zipfile.ZipFile(APP_PATH, "r") as z:
for fileinfo in z.infolist():
dat = z.open(fileinfo.filename, "r")
filename = fileinfo.filename
if not isinstance(filename, unicode):
filename = unicode(fileinfo.filename,
encoding="utf-8", errors="replace")
files.append(filename)
outfile = os.path.join(EXT_PATH, filename)
if not os.path.exists(os.path.dirname(outfile)):
try:
os.makedirs(os.path.dirname(outfile))
except OSError as exc: # Guard against race condition
if exc.errno != errno.EEXIST:
print "\n[WARN] OS Error: Race Condition"
if not outfile.endswith("/"):
with io.open(outfile, mode='wb') as f:
f.write(dat.read())
dat.close()
files.append(fileinfo.filename)
z.extract(fileinfo, EXT_PATH)
return files
except:
PrintException("[ERROR] Unzipping Error")
Expand Down

0 comments on commit 996bc85

Please sign in to comment.