diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2016-03-25 16:55:26 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2016-03-25 16:55:26 +0100 |
commit | 9f701d71b52ee045fb59747c74cbb5143d14c371 (patch) | |
tree | 17655537c80ca8033516dee575b61dcf1ab436b9 | |
parent | 88ead3a9622c4d1328800f42594ab2a0f4cc713b (diff) | |
download | feed2imap-9f701d71b52ee045fb59747c74cbb5143d14c371.tar.gz feed2imap-9f701d71b52ee045fb59747c74cbb5143d14c371.tar.bz2 feed2imap-9f701d71b52ee045fb59747c74cbb5143d14c371.zip |
image uri's may contain spaces
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/itemtomail.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb index 571b5f7..63445b0 100644 --- a/lib/feed2imap/itemtomail.rb +++ b/lib/feed2imap/itemtomail.rb @@ -96,7 +96,12 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images = html.gsub!(/(<img[^>]+)src="(\S+?\/([^\/]+?\.(png|gif|jpe?g)))"([^>]*>)/i) do |match| # $2 contains url, $3 the image name, $4 the image extension begin - image = Base64.encode64(fetcher.fetch($2, Time.at(0)).chomp) + if $2.include? " " + url = URI::escape $2 + else + url = $2 + end + image = Base64.encode64(fetcher.fetch(url, Time.at(0)).chomp) "#{$1}src=\"data:image/#{$4};base64,#{image}\"#{$5}" rescue @logger.error "Error while fetching image #{$2}: #{$!}..." |