diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2016-03-25 16:54:50 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2016-03-25 16:54:50 +0100 |
commit | 88ead3a9622c4d1328800f42594ab2a0f4cc713b (patch) | |
tree | c4f8394070b23bbcd4c9bcb6d3f24be2fd69100c /lib | |
parent | 99082038ec300153591376f700d5884b31293031 (diff) | |
download | feed2imap-88ead3a9622c4d1328800f42594ab2a0f4cc713b.tar.gz feed2imap-88ead3a9622c4d1328800f42594ab2a0f4cc713b.tar.bz2 feed2imap-88ead3a9622c4d1328800f42594ab2a0f4cc713b.zip |
Only one instance of the fetcher needed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/feed2imap/itemtomail.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb index a081616..571b5f7 100644 --- a/lib/feed2imap/itemtomail.rb +++ b/lib/feed2imap/itemtomail.rb @@ -91,11 +91,11 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images = # inline images as attachments imgs = [] if inline_images + fetcher = HTTPFetcher.new html = htmlpart.body.decoded html.gsub!(/(<img[^>]+)src="(\S+?\/([^\/]+?\.(png|gif|jpe?g)))"([^>]*>)/i) do |match| # $2 contains url, $3 the image name, $4 the image extension begin - fetcher = HTTPFetcher.new image = Base64.encode64(fetcher.fetch($2, Time.at(0)).chomp) "#{$1}src=\"data:image/#{$4};base64,#{image}\"#{$5}" rescue |