oscerd opened a new pull request, #25357:
URL: https://github.com/apache/camel/pull/25357

   Three body-related defects in the `google-mail-stream` consumer.
   
   **1. `raw=true` always produced a `null` body.** The consumer asked for the 
`FULL` format:
   
   ```java
   Message mess = getClient().users().messages().get("me", 
message.getId()).setFormat("FULL").execute();
   ...
   if (getConfiguration().isRaw()) { message.setBody(mail.getRaw()); }
   ```
   
   but Gmail only populates `raw` for `format=RAW`
   ([API 
reference](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages):
   _"Returned in messages.get and drafts.get responses when the format=RAW 
parameter is supplied."_).
   The requested format now follows the option.
   
   Since the `RAW` format does not return the parsed `payload`, a route with 
`raw=true` no longer gets
   the subject/from/to/cc/bcc/message-id headers — they are part of the RFC 
2822 content that is now in
   the body. That is covered by an upgrade-guide entry.
   
   **2. Messages that are not multipart arrived with no body.** The old code 
only looked at
   `getPayload().getParts()`, which is `null` for a plain message — its content 
sits directly on
   `payload.body.data`. Nested multiparts (a `multipart/mixed` inside a 
`multipart/alternative`) were
   also skipped, because `parts.get(0).getBody().getData()` is `null` for a 
part that only holds other
   parts. The body is now taken from the first part that actually carries data, 
descending into nested
   parts.
   
   **3. `getPayload()` and `getPayload().getHeaders()` were dereferenced 
unguarded** — both are absent
   for some message formats and metadata-only responses.
   
   Also: `processRollback` re-added the `UNREAD` label even when `markAsRead` 
was never enabled, so a
   failed exchange mutated the mailbox for routes that had not asked for it; 
and its catch block
   reported "Error occurred mark as read mail" for a rollback failure.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to