Control: tags -1 + patch

Found the problem.

In itemtomail.rb there are a couple of commented-out print statements
for debugging:

  print "#{cid}: Replacing '#{$&}' with '#{newtag}'...\n"
  ...
  print "Error while fetching image #{$2}: #{$!}...\n"

With those uncommented, I get the following output when running
feed2imap:

  Error while fetching image 
http://gwolf.org/files/images/11194600_10206683440551815_3215489579656446032_o.preview.jpg:
 undefined method `fetch' for HTTPFetcher:Class...

Comparing with the source of httpfetcher.rb in feed2imap package version
1.0-2 (oldstable), I see that there was some refactoring, I'm not a Ruby
programmer, but looks like the 'fetch' method of class HTTPFetcher
changed from being a static method to an instance method.  Attached is a
patch which re-introduces the "static" method to keep itemtomail.rb
working for inline images again, as well as make one of the [presumably
unexecuted] unit tests, tc_httpfetcher.rb, happy.

With this fix in place I now get the debugging output:

  921d1c349d2fbecb6e20518342016f26@hostname: Replacing '<img alt="Bestest 
birthday ever" class="image image-preview " height="640" 
src="http://gwolf.org/files/images/11194600_10206683440551815_3215489579656446032_o.preview.jpg";
 title="Bestest birthday ever" width="480" />' with '<img alt="Bestest birthday 
ever" class="image image-preview " height="640" 
src="cid:921d1c349d2fbecb6e20518342016f26@hostname" title="Bestest birthday 
ever" width="480" />'...

Thanks!

-- 
Gerald Turner <gtur...@unzane.com>        Encrypted mail preferred!
OpenPGP: 4096R / CA89 B27A 30FA 66C5 1B80  3858 EC94 2276 FDB8 716D
Description: Fix support for include-images configuration option
 Re-define HTTPFetcher::fetch method like 1.0 codebase had, which is still used
 by itemtomail.rb for inline images, and tc_httpfetcher.rb unit test
Author: Gerald Turner <gtur...@unzane.com>
Bug-Debian: https://bugs.debian.org/784591

--- feed2imap-1.2.4.orig/lib/feed2imap/httpfetcher.rb
+++ feed2imap-1.2.4/lib/feed2imap/httpfetcher.rb
@@ -119,4 +119,11 @@ class HTTPFetcher
     uri = URI::parse(url)
     return fetcher(uri, uri, lastcheck, MAXREDIR)
   end
+
+  # Re-define static(?) method like 1.0 codebase had, which is still used by
+  # itemtomail.rb for inline images, and tc_httpfetcher.rb unit test
+  def HTTPFetcher::fetch(url, lastcheck)
+    fetcher = HTTPFetcher::new
+    return fetcher.fetch(url, lastcheck)
+  end
 end

Attachment: signature.asc
Description: PGP signature

Reply via email to