chibenwa commented on code in PR #2661: URL: https://github.com/apache/james-project/pull/2661#discussion_r1975272334
########## server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailSet.scala: ########## @@ -395,9 +409,40 @@ case class EmailCreationRequest(mailboxIds: MailboxIds, } } - private def retrieveCorrespondingBody(clientBody: ClientBody): Option[Either[IllegalArgumentException, Some[ClientBodyPart]]] = + private def retrieveCorrespondingBody(clientBody2: ClientBody, + blobResolvers: BlobResolvers, + mailboxSession: MailboxSession): Option[Either[IllegalArgumentException, Some[ClientBodyPart]]] = + clientBody2.validate().fold( + error => Some(Left(error)), + validatedClientBody => validatedClientBody.partId match { + case Some(_) => retrieveCorrespondingBodyFromPartId(clientBody2) + case None => retrieveCorrespondingBodyFromBlobId(clientBody2, blobResolvers, mailboxSession) + }) + + private def retrieveCorrespondingBodyFromBlobId(clientBody2: ClientBody, + blobResolvers: BlobResolvers, + mailboxSession: MailboxSession): Option[Either[IllegalArgumentException, Some[ClientBodyPart]]] = + clientBody2.blobId.flatMap { blobIdValue => + Option(blobResolvers.resolve(blobIdValue, mailboxSession).block()).map { Review Comment: Indeed -- 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: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org