diff --git a/utils/proxy/_deserializer.py b/utils/proxy/_deserializer.py index 204fb70b9e..8afdbc44d2 100644 --- a/utils/proxy/_deserializer.py +++ b/utils/proxy/_deserializer.py @@ -194,8 +194,12 @@ def json_load(): item["content"] = json.loads(part.content) elif content_type_part == "application/gzip": - with gzip.GzipFile(fileobj=io.BytesIO(part.content)) as gz_file: - content = gz_file.read() + try: + with gzip.GzipFile(fileobj=io.BytesIO(part.content)) as gz_file: + content = gz_file.read() + except: + item["system-tests-error"] = "Can't decompress gzip data" + continue _deserialize_file_in_multipart_form_data(item, headers, export_content_files_to, content) @@ -239,6 +243,8 @@ def _deserialize_file_in_multipart_form_data( item["system-tests-error"] = "Filename not found in content-disposition, please contact #apm-shared-testing" else: filename = meta_data["filename"].strip('"') + if filename.lower().endswith(".gz"): + filename = filename[:-3] file_path = f"{export_content_files_to}/{md5(content).hexdigest()}_{filename}" with open(file_path, "wb") as f: