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

rasterize-email-unique-file #37323

Merged
merged 17 commits into from
Nov 26, 2024
Merged
20 changes: 12 additions & 8 deletions Packs/rasterize/Integrations/rasterize/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,14 @@ def rasterize_email_command(): # pragma: no cover

navigation_timeout = int(demisto.args().get('max_page_load_time', DEFAULT_PAGE_LOAD_TIME))

with open('htmlBody.html', 'w', encoding='utf-8-sig') as f:
f.write(f'<html style="background:white";>{html_body}</html>')

path = f'file://{os.path.realpath(f.name)}'

rasterize_output = perform_rasterize(path=path, rasterize_type=rasterize_type, width=width, height=height,
offline_mode=offline, navigation_timeout=navigation_timeout, full_screen=full_screen)
with tempfile.NamedTemporaryFile(mode='w', suffix='.html', encoding='utf-8-sig') as tf:
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved
demisto.debug(f'{html_body=}')
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved
tf.write(f'<html style="background:white";>{html_body}</html>')
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved
tf.flush()
path = f'file://{os.path.realpath(tf.name)}'
demisto.debug(f'{path=}')
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved
rasterize_output = perform_rasterize(path=path, rasterize_type=rasterize_type, width=width, height=height,
offline_mode=offline, navigation_timeout=navigation_timeout, full_screen=full_screen)

res = fileResult(filename=file_name, data=rasterize_output[0][0])
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -1186,7 +1187,10 @@ def get_width_height(args: dict):


def main(): # pragma: no cover
demisto.debug(f"main, {demisto.command()=}")
incident = demisto.incident()
incident_id = incident.get('id')
incident_name = incident.get('name')
demisto.debug(f"main, {demisto.command()=}, {incident_id=}, {incident_name=}")
MosheEichler marked this conversation as resolved.
Show resolved Hide resolved
demisto.debug(f'Using performance params: {MAX_CHROMES_COUNT=}, {MAX_CHROME_TABS_COUNT=}, {MAX_RASTERIZATIONS_COUNT=}')
threading.excepthook = excepthook_recv_loop
try:
Expand Down
6 changes: 6 additions & 0 deletions Packs/rasterize/ReleaseNotes/2_0_29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Integrations

##### Rasterize

- Improved implementation of the *rasterize-email* command.
2 changes: 1 addition & 1 deletion Packs/rasterize/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Rasterize",
"description": "Converts URLs, PDF files, and emails to an image file or PDF file.",
"support": "xsoar",
"currentVersion": "2.0.28",
"currentVersion": "2.0.29",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Loading