Skip to content

Handle edge case where attachment part is missing filename #1332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

lao9
Copy link

@lao9 lao9 commented Mar 22, 2019

Fixes #1329

Semi-inspired by php-mime-mail-parser:

Recommending that when the part is missing both content-location and filename, we check the type and provide a default filename if it is an attachment type.

@lao9
Copy link
Author

lao9 commented May 30, 2019

Hey @jeremy! Wondering if you could take a look at this PR when you get a chance and provide any feedback?

Copy link
Collaborator

@jeremy jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Thanks for digging in.

Noting that the underlying issue is that we rely on presence of filename to imply that a part is an attachment. Perhaps we should change that to be more expansive. Having to provide an "untitled" filename is a workaround that will cause emails to no longer round-trip (resending an email will change a part's filename to "untitled").

end
@attachment_name
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the message itself should be responsible for determining whether it's an attachment, rather than its Content-Type field.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look and providing feedback @jeremy . I can re-work this a bit and get back to you. Agree that the longer round-trip isn't ideal.

lao9 pushed a commit to considerhq/mail that referenced this pull request Jul 8, 2019
Fixes mikel#1329

First attempt at a fix: mikel#1332

In this second attempt, I tried to scope down the issue to where the issue appears most probable: inline images.

We do not add a default filename for the nameless attachment, rather just ensure that the message part is considered an attachment if it is an inline image.
@lao9
Copy link
Author

lao9 commented Jul 8, 2019

Closing in favor of fix in this PR: #1350

@lao9 lao9 closed this Jul 8, 2019
@lao9 lao9 deleted the lo/add-attachment-name-to-content-type branch July 8, 2019 17:44
lao9 pushed a commit to considerhq/mail that referenced this pull request Jul 8, 2019
Fixes mikel#1329

First attempt at a fix: mikel#1332

In this second attempt, I tried to scope down the issue to where the issue appears most probable: inline images.

We do not add a default filename for the nameless attachment, rather just ensure that the message part is considered an attachment if it is an inline image.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attachments/parts not parsed from real-world email
2 participants