--- /usr/share/pyshared/apport/crashdb_impl/launchpad.py 2010-05-03 12:26:20.000000000 +0200 +++ launchpad.py.1.13.3-0ubuntu2.new 2010-05-03 12:43:44.000000000 +0200 @@ -285,10 +285,14 @@ report[key] = '' except: continue - if ext == '.txt': - report[key] = attachment.read() - elif ext == '.gz': - report[key] = gzip.GzipFile(fileobj=attachment).read()#TODO: is this the best solution? + data = attachment.read() + # Check gzip header + if data[:2] == '\037\213': + datastream = StringIO(data) + report[key] = gzip.GzipFile(fileobj=datastream).read()#TODO: is this the best solution? + elif ext in ['.txt','.gz']: + # default for known extensions + report[key] = data else: raise Exception, 'Unknown attachment type: ' + attachment.filename return report