chibenwa commented on a change in pull request #582:
URL: https://github.com/apache/james-project/pull/582#discussion_r685759043



##########
File path: 
server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/MessageAppender.java
##########
@@ -176,35 +170,29 @@ private Flags getFlags(CreationMessage message) {
     }
 
     private ImmutableList<MessageAttachmentMetadata> 
getMessageAttachments(MailboxSession session, ImmutableList<Attachment> 
attachments) throws MailboxException {
-        Map<AttachmentId, AttachmentMetadata> attachmentsById = 
attachmentManager.getAttachments(attachments.stream()
-            .map(attachment -> 
AttachmentId.from(attachment.getBlobId().getRawValue()))
-            .collect(ImmutableList.toImmutableList()), session)
+        return attachments
             .stream()
-            
.collect(ImmutableMap.toImmutableMap(AttachmentMetadata::getAttachmentId, 
Function.identity()));
-
-        ThrowingFunction<Attachment, Optional<MessageAttachmentMetadata>> 
toMessageAttachment = att -> messageAttachment(att, attachmentsById);
-
-
-        return attachments.stream()
-            .map(Throwing.function(toMessageAttachment).sneakyThrow())
-            .flatMap(Optional::stream)
+            .flatMap(attachment -> {
+                try {
+                    Blob blob = blobManager.retrieve(attachment.getBlobId(), 
session);
+                    return Stream.of(MessageAttachmentMetadata.builder()
+                        .attachment(AttachmentMetadata.builder()
+                            
.attachmentId(AttachmentId.from(blob.getBlobId().getRawValue()))

Review comment:
       Solved in https://github.com/apache/james-project/pull/584 (upcoming)




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