Fix for bad open on tarfile

svn: r14306
This commit is contained in:
Doug Blank 2010-02-10 22:11:48 +00:00
parent 458c42b0d4
commit 8abe461bb9

View File

@ -532,9 +532,14 @@ class PluginStatus(ManagedWindow.ManagedWindow):
if path.endswith(".zip") or path.endswith(".ZIP"):
file_obj = Zipfile(buffer)
elif path.endswith(".tar.gz") or path.endswith(".tgz"):
try:
file_obj = tarfile.open(None, fileobj=buffer)
except:
callback(_("Error: cannot open '%s'") % path)
return
else:
return [("Error: unknown file type: '%s'") % path]
callback(_("Error: unknown file type: '%s'") % path)
return
# First, see what versions we have/are getting:
good_gpr = set()
for gpr_file in [name for name in file_obj.getnames() if name.endswith(".gpr.py")]: