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

PreproccessEmail: correct the if condition #26361

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Packs/EmailCommunication/ReleaseNotes/2_0_7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#### Scripts

##### PreprocessEmail

- Fixed an issue where script failed when there is no *emailsubject* in the incident.
- Updated the Docker image to: *demisto/python3:3.10.11.57293*.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def get_email_related_incident_id(email_related_incident_code, email_original_su
incidents_details = get_incident_by_query(query)

for incident in incidents_details:
if email_original_subject in incident.get('emailsubject', ''):
email_subject = incident.get('emailsubject', '')
if email_subject and email_original_subject in email_subject:
return str(incident.get('id'))
else:
# If 'emailsubject' doesn't match, check 'EmailThreads' context entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tags:
- email
- preProcessing
type: python
dockerimage: demisto/python3:3.10.9.45313
dockerimage: demisto/python3:3.10.11.57293
runas: DBotRole
tests:
- No tests (auto formatted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def test_get_email_related_incident_id_email_in_context(mocker):
"""
import PreprocessEmail
from PreprocessEmail import get_email_related_incident_id
mocker.patch.object(PreprocessEmail, 'get_incident_by_query', return_value=[{'emailsubject': '', 'id': '3'}])
mocker.patch.object(PreprocessEmail, 'get_incident_by_query', return_value=[{'emailsubject': None, 'id': '3'}])
mocker.patch.object(demisto, 'executeCommand', return_value=EMAIL_THREADS)
id = get_email_related_incident_id('69433507', 'Test Email 2')
assert id == '3'
4 changes: 2 additions & 2 deletions Packs/EmailCommunication/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Email Communication",
"description": "Do you have to send multiple emails to end users? This content pack helps you streamline the process and automate updates, notifications and more.\n",
"support": "xsoar",
"currentVersion": "2.0.6",
"currentVersion": "2.0.7",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"videos": [
Expand Down Expand Up @@ -35,4 +35,4 @@
"Email",
"Add"
]
}
}