File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -75,16 +75,18 @@ def html_part
7575
7676 def html_part_images_inlined
7777 # TODO: Find a better home for this bit of code
78- t = TransformHtml . new ( html_part )
79- doc = t . nokogiri
80- doc . search ( "img" ) . each do |img |
81- if img [ "src" ] [ 0 ..3 ] == "cid:"
82- a = mail . attachments . find { |a | a . url == img [ "src" ] }
83- # Construct the data url
84- img [ "src" ] = "data:#{ a . mime_type } ;base64,#{ Base64 . encode64 ( a . body . decoded ) } " if a
78+ if html_part
79+ t = TransformHtml . new ( html_part )
80+ doc = t . nokogiri
81+ doc . search ( "img" ) . each do |img |
82+ if img [ "src" ] [ 0 ..3 ] == "cid:"
83+ a = mail . attachments . find { |a | a . url == img [ "src" ] }
84+ # Construct the data url
85+ img [ "src" ] = "data:#{ a . mime_type } ;base64,#{ Base64 . encode64 ( a . body . decoded ) } " if a
86+ end
8587 end
88+ doc . to_s
8689 end
87- doc . to_s
8890 end
8991
9092 # First part with a particular mime type
You can’t perform that action at this time.
0 commit comments