diff --git a/internal_packages/attachments/lib/attachment-component.cjsx b/internal_packages/attachments/lib/attachment-component.cjsx index 3aa8ae747..f35f199a6 100644 --- a/internal_packages/attachments/lib/attachment-component.cjsx +++ b/internal_packages/attachments/lib/attachment-component.cjsx @@ -39,7 +39,7 @@ class AttachmentComponent extends React.Component fallback="file-fallback.png" name="file-#{@_extension()}.png"/> - {@props.file.filename} + {@props.file.filename ? "Unnamed Attachment"} diff --git a/internal_packages/message-list/lib/message-item.cjsx b/internal_packages/message-list/lib/message-item.cjsx index 0c3edb05f..dc4b7a23a 100644 --- a/internal_packages/message-list/lib/message-item.cjsx +++ b/internal_packages/message-list/lib/message-item.cjsx @@ -296,12 +296,9 @@ class MessageItem extends React.Component return otherAttachments.concat(imageAttachments) - # We ignore files with no name because they're actually mime-parts of the - # message being served by the API as files. _isRealFile: (file) -> - hasName = file.filename and file.filename.length > 0 hasCIDInBody = file.contentId? and @props.message.body?.indexOf(file.contentId) > 0 - return hasName and not hasCIDInBody + return not hasCIDInBody _isForwardedMessage: => Utils.isForwardedMessage(@props.message) diff --git a/internal_packages/message-list/spec/message-item-spec.cjsx b/internal_packages/message-list/spec/message-item-spec.cjsx index d33cc109a..7f392949d 100644 --- a/internal_packages/message-list/spec/message-item-spec.cjsx +++ b/internal_packages/message-list/spec/message-item-spec.cjsx @@ -53,11 +53,10 @@ file_cid_but_not_referenced_or_image = new File contentId: 'file_cid_but_not_referenced_or_image' contentType: 'text/plain' size: 300 -file_actually_a_mime_part = new File - id: 'file_actually_a_mime_part' - contentId: 'file_actually_a_mime_part' - contentType: 'text/html' - size: 300 +file_without_filename = new File + id: 'file_without_filename' + contentType: 'image/png' + size: 10 download = fileId: 'file_1_id' @@ -178,7 +177,7 @@ describe "MessageItem", -> file_inline, file_inline_downloading, file_inline_not_downloaded, - file_actually_a_mime_part + file_without_filename ] @message.body = """ \"A\" @@ -198,17 +197,12 @@ describe "MessageItem", -> it "should list attachments that are not mentioned in the body via cid", -> attachments = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@component, InjectedComponent, matching: {role: 'Attachment'}) - expect(attachments.length).toEqual(4) + expect(attachments.length).toEqual(5) expect(attachments[0].props.exposedProps.file).toBe(file) expect(attachments[1].props.exposedProps.file).toBe(file_not_downloaded) expect(attachments[2].props.exposedProps.file).toBe(file_cid_but_not_referenced) expect(attachments[3].props.exposedProps.file).toBe(file_cid_but_not_referenced_or_image) - it "should list attachments without a filename", -> - attachments = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@component, InjectedComponent, matching: {role: 'Attachment'}) - for attachment in attachments - expect(attachment.props.exposedProps.file).not.toBe(file_actually_a_mime_part) - it "should provide file download state to each InjectedComponent", -> attachments = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@component, InjectedComponent, matching: {role: 'Attachment'}) expect(attachments[0].props.exposedProps.download).toBe(download) @@ -218,7 +212,7 @@ describe "MessageItem", -> @message.body = "" @createComponent() attachments = ReactTestUtils.scryRenderedComponentsWithTypeAndProps(@component, InjectedComponent, matching: {role: 'Attachment'}) - expect(attachments.length).toEqual(7) + expect(attachments.length).toEqual(8) describe "inline", -> it "should never leave src=cid:// in the message body", ->