-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Action enhancement - Gmail - Find email #16938
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
Action enhancement - Gmail - Find email #16938
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
@hugobiais is attempting to deploy a commit to the Pipedreamers Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe changes introduce new utility functions for decoding and extracting plain text from Gmail message payloads, update the logic for processing message parts in the Gmail Search Email action, and ensure the "message-id" header is extracted and included in the returned payload. Package versions are incremented accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FindEmailAction
participant GmailAPI
participant Utils
User->>FindEmailAction: Trigger search email action
FindEmailAction->>GmailAPI: Fetch message payload
GmailAPI-->>FindEmailAction: Return message data
FindEmailAction->>Utils: decodeBase64Url / extractTextFromParts / attachTextToParts
Utils-->>FindEmailAction: Decoded and extracted text, message-id
FindEmailAction-->>User: Return processed payload with message_id and plain text
Assessment against linked issues
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
components/gmail/actions/find-email/utils.mjs (1)
1-1: Add JSDoc documentation for the module.Following the Pipedream component guidelines, add module-level documentation.
+/** + * Utility functions for processing Gmail message payloads and MIME parts. + * Handles base64url decoding and text extraction from complex MIME structures. + */ import { convert } from "html-to-text";components/gmail/actions/find-email/find-email.mjs (1)
65-65: Consider initializing newPayload conditionally.Minor optimization: only initialize
newPayloadwhenwithTextPayloadis true to make the intent clearer.for await (const message of messagesToEmit) { - let newPayload = ""; + let newPayload = this.withTextPayload ? "" : undefined;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/gmail/actions/find-email/find-email.mjs(2 hunks)components/gmail/actions/find-email/utils.mjs(1 hunks)
🔇 Additional comments (4)
components/gmail/actions/find-email/find-email.mjs (4)
3-7: LGTM! Clean import of utility functions.The import structure is well-organized and follows ES6 module conventions properly.
13-13: LGTM! Appropriate version bump for bug fix.Version bump to 0.1.1 is appropriate for addressing the empty payload issue mentioned in the PR objectives.
67-72: LGTM! Correct message-id header extraction.The header extraction logic properly handles case-insensitive lookup and safely assigns the value. This addresses one of the requirements mentioned in the PR objectives.
83-89: LGTM! Proper handling of multipart messages.The conditional logic correctly uses the appropriate utility functions based on the
withTextPayloadflag, which should resolve the empty payload issue mentioned in the PR objectives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
components/gmail/actions/find-email/find-email.mjs(2 hunks)components/gmail/common/utils.mjs(2 hunks)components/gmail/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/gmail/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
- components/gmail/actions/find-email/find-email.mjs
🔇 Additional comments (2)
components/gmail/common/utils.mjs (2)
1-1: LGTM: Import statement is appropriate.The html-to-text import is correctly used for converting HTML content to plain text in the utility functions.
49-54: LGTM: Export structure is clean.The export object properly exposes all utility functions including the existing parseArray function.
michelle0927
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for QA!
Summary
Resolves #16932 and another problem where, with
withTextPayloadenabled, the payload could end up empty.Changes
find-email.mjs
0.1.1utils.mjs.runlogic so that:withTextPayload = false, each part’s decoded text is attached topart.body.text(preserving the original MIME structure).withTextPayload = true, all decoded text is concatenated and set tomessage.payload(avoiding empty payloads).utils.mjs
decodeBase64Url(data): Converts Gmail’s base64url strings into UTF-8.extractTextFromParts(parts): Recursively walks nested parts, decodes text/plain and converts text/html to plain text.attachTextToParts(parts): Recursively traverses and attaches decoded text to part.body.text for each text/plain or text/html part.Why
Correct Base64 decoding: Gmail returns message bodies as base64url; using standard
"base64"decoding could produce garbled content. Converting-→+and_→/ensures reliable results.Nested MIME handling: Previously, deeply nested parts could be skipped, leading to missing or empty payloads when
withTextPayload = true. The new recursive helpers guarantee no text is lost.Readability and maintainability: Extracting decoding and part traversal into
utils.mjsseparates concerns, making it easier to reason about payload mutation versus text extraction.How to test
1. Publish the component:
2. Test without
withTextPayload:message.payload.parts[i].body.textexists for each part and contains the decoded content.message.payloadare overwritten.3. Test with
withTextPayload = true:withTextPayloadtotrue.message.payloadis a single string containing all decoded text (HTML converted to plain text) and is never empty.4. Verify Message-ID extraction:
message.message_idmatches theMessage-IDheader in Gmail.5. Potential edge cases:
multipart/mixed→multipart/alternative→text/plain&text/html).payload.body.data(attachment-only); ensure no runtime errors occur and payload remains unchanged ifwithTextPayload = false.Ressources
Summary by CodeRabbit
New Features
Bug Fixes
Chores