Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sane-pdf-reports] - fix issue where large customer logos were not parsed correctly #34862

Merged
merged 10 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Packs/Base/ReleaseNotes/1_34_16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#### Scripts

##### SanePdfReports

- Added support for large customer logos up to 5MB.
- Updated the Docker image to: *demisto/sane-pdf-reports:1.0.0.96883*.
15 changes: 11 additions & 4 deletions Packs/Base/Scripts/SanePdfReport/SanePdfReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def do_GET(self):


def main(): # pragma: no cover
isMDImagesSupported = is_demisto_version_ge(MD_IMAGE_SUPPORT_MIN_VER)
try:
sane_json_b64 = demisto.args().get('sane_pdf_report_base64', '').encode(
'utf-8')
Expand Down Expand Up @@ -196,6 +197,13 @@ def main(): # pragma: no cover
with open(input_file, 'wb') as f:
f.write(base64.b64decode(sane_json_b64))

if headerLeftImage:
customer_logo_file_path = tmpdir + "/customer-logo-base64.txt"
with open(customer_logo_file_path, "w") as f:
f.write(headerLeftImage)
extra_cmd = extra_cmd.replace(headerLeftImage, customer_logo_file_path)
headerLeftImage = customer_logo_file_path

cmd = ['./reportsServer', input_file, output_file, dist_dir] + shlex.split(
extra_cmd)

Expand All @@ -210,15 +218,14 @@ def main(): # pragma: no cover
if isMDImagesSupported:
params += f', markdownArtifactsServerAddress="{mdServerAddress}"'

LOG(f"Sane-pdf parameters: {params}]")
demisto.debug(f"Sane-PDF parameters: {params}]")
cmd_string = " ".join(cmd)
LOG(f"Sane-pdf cmd: {cmd_string}")
LOG.print_log()
demisto.debug(f'Sane-PDF report commmad: {cmd_string}')

# Execute the report creation
out = subprocess.check_output(cmd, cwd=WORKING_DIR,
stderr=subprocess.STDOUT)
LOG(f"Sane-pdf output: {str(out)}")
demisto.debug(f"Sane-pdf output: {str(out)}")

with open(output_file, 'rb') as f:
encoded = base64.b64encode(f.read()).decode('utf-8', 'ignore')
Expand Down
2 changes: 1 addition & 1 deletion Packs/Base/Scripts/SanePdfReport/SanePdfReport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tags:
- pdf
timeout: '0'
type: python
dockerimage: demisto/sane-pdf-reports:1.0.0.95847
dockerimage: demisto/sane-pdf-reports:1.0.0.96883
runas: DBotWeakRole
tests:
- No Test
Expand Down
2 changes: 1 addition & 1 deletion Packs/Base/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Base",
"description": "The base pack for Cortex XSOAR.",
"support": "xsoar",
"currentVersion": "1.34.15",
"currentVersion": "1.34.16",
"author": "Cortex XSOAR",
"serverMinVersion": "6.0.0",
"url": "https://www.paloaltonetworks.com/cortex",
Expand Down
Loading