Skip to content

fixed handling RFC822 email files#44552

Open
merit-maita wants to merge 3 commits into
masterfrom
parse-email-files-bug
Open

fixed handling RFC822 email files#44552
merit-maita wants to merge 3 commits into
masterfrom
parse-email-files-bug

Conversation

@merit-maita
Copy link
Copy Markdown
Contributor

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Related Issues

Description

Must have

  • Tests
  • Documentation

# Conflicts:
#	Packs/CommonScripts/ReleaseNotes/1_22_15.md
#	Packs/CommonScripts/pack_metadata.json
@content-bot
Copy link
Copy Markdown
Contributor

🤖 AI-Powered Code Review Available

You can leverage AI-powered code review to assist with this PR!

Available Commands:

  • @marketplace-ai-reviewer start review - Initiate a full AI code review
  • @marketplace-ai-reviewer re-review - Incremental review for new commits

@merit-maita merit-maita requested a review from kamalq97 June 7, 2026 14:19
@merit-maita merit-maita self-assigned this Jun 7, 2026
@merit-maita merit-maita added ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. labels Jun 7, 2026
@marketplace-ai-reviewer marketplace-ai-reviewer removed the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jun 7, 2026
@marketplace-ai-reviewer
Copy link
Copy Markdown
Contributor

🤖 Analysis started. Please wait for results...

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
Packs/CommonScripts/Scripts/ParseEmailFilesV2
   ParseEmailFilesV2.py1221091%75, 82, 141, 154–155, 158–159, 161–162, 188
TOTAL1221091% 

Tests Skipped Failures Errors Time
21 0 💤 0 ❌ 0 🔥 3.376s ⏱️

@marketplace-ai-reviewer
Copy link
Copy Markdown
Contributor

🤖 AI Review Disclaimer

This review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause.

Copy link
Copy Markdown
Contributor

@marketplace-ai-reviewer marketplace-ai-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to the ParseEmailFilesV2 script! The updates look good, but there are a few areas to tighten up regarding error handling, testing, and formatting. Specifically, please add safety checks to prevent AttributeErrors with None values, include a unit test for the new EML misclassification logic, and ensure Docker image tags in the release notes are bolded rather than italicized. Let me know if you have any questions!

Additionally, please address the following file-level notes:

  • Packs/CommonScripts/Scripts/ParseEmailFilesV2/ParseEmailFilesV2.py: Missing unit test for EML misclassification logic.

@kamalq97, @merit-maita please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.

#### Scripts
##### ParseEmailFilesV2
- Fixed an issue where it failed to parse certain valid RFC822 email files due to incorrect file type detection.
- Updated the Docker image to: *demisto/parse-emails:0.1.48.8921488*. No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Values such as Docker image tags must be styled as bold instead of italics.

demisto.debug(f"{file_type=} seems wrong, changing it to {file_info=}")
file_type = file_info

if file_name.lower().endswith(".eml") and ("iso-8859" in file_type.lower() or "mime entity" in file_type.lower()):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add safety checks to prevent AttributeError if file_name or file_type are None.

file_type = file_info

if file_name.lower().endswith(".eml") and ("iso-8859" in file_type.lower() or "mime entity" in file_type.lower()):
demisto.debug(f"Detected EML file misclassified as text ({file_type}), " "forcing RFC822 parsing.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify string concatenation.

@content-bot
Copy link
Copy Markdown
Contributor

🔍 AI Triage Report Available

An automated triage report has been generated for this pipeline.

Status: success
Report ID: 5f619804ad257011

📋 Triage Report

⚠️ AI-generated triage. Validate before acting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants