Skip to content

Handle edge case when inline image attachment part is missing a filename #1350

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lao9
Copy link

@lao9 lao9 commented Jul 8, 2019

Fixes #1329

First attempt at a fix: #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

Hey @jeremy . If you have a free moment, I looked at your comments in #1332 and am proposing this fix instead. Let me know if you have any feedback.

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 lao9 force-pushed the lo/message-handle-attachment branch from 79c3c8d to 401b4e5 Compare July 8, 2019 18:03
@steobrien
Copy link

I'd love to see this merged in soon to fix an issue we’re seeing. @jeremy, anything you're waiting on before accepting this patch?

@jeremy jeremy added this to the 2.7.2 milestone Nov 15, 2019
@@ -2135,6 +2135,14 @@ def find_attachment
filename
end

def inline_image?
image? && inline?
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

inline? is a method on the Mail::Part subclass, so this'll break for a Mail::Message itself.

Could move this into Mail::Part and override the attachment? method, perhaps?

# class Part < Message

def attachment?
  super || inline_image?
end

# …

def inline_image?
  # …

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 the feedback - I'll try to get this in next by next week!

@jeremy jeremy modified the milestones: 2.7.2, 2.8.0 Nov 15, 2019
@jeremy
Copy link
Collaborator

jeremy commented Nov 15, 2019

(Moved to 2.8.0 release as this technically breaks compatibility with current stable 2.7.x.)

@mikel
Copy link
Owner

mikel commented Dec 3, 2022

@lao9 Please update this to latest master.

Moved to 2.9 as it breaks compatibility with 2.7 and 2.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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