Skip to content
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

Tiny bug (fix) in entity_tmail.rb's from_tmail(tmail) #6

Open
LouisStAmour opened this issue Apr 26, 2010 · 0 comments
Open

Tiny bug (fix) in entity_tmail.rb's from_tmail(tmail) #6

LouisStAmour opened this issue Apr 26, 2010 · 0 comments

Comments

@LouisStAmour
Copy link

Seems there are instance variables in this method where there shouldn't be. Replace each so the method looks like this and you won't get any whiny nil errors about nil.header calls:

def from_tmail(tmail)
  raise ArgumentError, "Expecting a TMail::Mail object." unless tmail.is_a?(TMail::Mail)
  @headers ||= Hash.new {|h,k| tmail.header[k].to_s }
  if multipart?
    @content = tmail.parts.collect { |tpart| Entity.new.from_tmail(tpart) }
  else
    set_content tmail.body # TMail has already decoded it, but we need it still encoded
  end
end
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

No branches or pull requests

1 participant