chibenwa opened a new pull request, #3234:
URL: https://github.com/apache/james-project/pull/3234

   Reported downstream in https://github.com/linagora/tmail-backend/issues/2685
   
   ## Problem
   
   `Email/set` `create` silently ignored `bodyStructure` (not implemented, 
JAMES-3536) and any unknown property. A create with only a `bodyStructure` was 
accepted and stored an email with an **empty** `text/plain` body: the client 
was told it succeeded and the content was lost.
   
   RFC 8621 §4.6: creation attempts violating its constraints SHOULD be 
rejected with `invalidProperties`. RFC 8620 §5.3 defines `invalidProperties` 
for records containing invalid properties.
   
   ## Change
   
   - `EmailCreationRequest.validateProperties`: a create containing 
`bodyStructure` (alone or with `textBody`/`htmlBody`/`attachments`) is rejected 
with `invalidProperties`, `properties: ["bodyStructure"]`, and a description 
pointing to `textBody`/`htmlBody`/`attachments`.
   - Any key that is neither a supported Email creation property nor a 
`header:` form is rejected with `invalidProperties` listing those keys.
   - `headers` keeps its existing `invalidArguments` error (property validation 
runs after deserialization).
   - Spec doc note updated.
   
   Implementing `bodyStructure` itself (the full JAMES-3536) is out of scope.
   
   ## Tests
   
   New `EmailSetMethodContract` tests: `bodyStructure` only, `bodyStructure` + 
`htmlBody`, unknown property. Memory `EmailSetMethodTest`, 
`EmailSubmissionSetMethodTest`, `EmailGetMethodTest`, `EmailChangesMethodTest`, 
`EventSourceTest` and `WebSocketTest` pass.
   
   ---
   *Generated automatically*
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to