Codebase list feed2imap / debian/1.2.3-1+deb8u1
fix the `include-images` option Closes: #784591 Antonio Terceiro 8 years ago
3 changed file(s) with 105 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11
22 * debian/patches/0001-Fix-usage-of-filters.patch: apply upstream patch to
33 fix usage of filters (Closes: #783444)
4 * debian/patches/0002-Fix-regression-in-include-images-option.patch: apply
5 upstream patch to fix the `include-images` option (Closes: #784591)
46
57 -- Antonio Terceiro <terceiro@debian.org> Sun, 10 May 2015 20:08:43 -0300
68
0 From 4614e1fa4ff4cb5d7442f680a053298e0cc80819 Mon Sep 17 00:00:00 2001
1 From: Antonio Terceiro <terceiro@softwarelivre.org>
2 Date: Sun, 10 May 2015 20:40:19 -0300
3 Subject: [PATCH] Fix regression in `include-images` option
4
5 test/tc_httpfetcher.rb can't still be re-enabled because it hits the
6 network, and a hostname that is no longer valid.
7 ---
8 feed2imap-test | 1 +
9 lib/feed2imap/itemtomail.rb | 3 ++-
10 test/tc_httpfetcher.rb | 20 +++++++++++++-------
11 3 files changed, 16 insertions(+), 8 deletions(-)
12
13 diff --git a/lib/feed2imap/itemtomail.rb b/lib/feed2imap/itemtomail.rb
14 index fcf8f8b..455a136 100644
15 --- a/lib/feed2imap/itemtomail.rb
16 +++ b/lib/feed2imap/itemtomail.rb
17 @@ -99,7 +99,8 @@ def item_to_mail(config, item, id, updated, from = 'Feed2Imap', inline_images =
18 htmlpart.body.gsub!(/(<img[^>]+)src="(\S+?\/([^\/]+?\.(png|gif|jpe?g)))"([^>]*>)/i) do |match|
19 # $2 contains url, $3 the image name, $4 the image extension
20 begin
21 - image = Base64.encode64(HTTPFetcher::fetch($2, Time.at(0)).chomp) + "\n"
22 + fetcher = HTTPFetcher.new
23 + image = Base64.encode64(fetcher.fetch($2, Time.at(0)).chomp) + "\n"
24 cid = "#{Digest::MD5.hexdigest($2)}@#{config.hostname}"
25 if not cids.include?(cid)
26 cids << cid
27 diff --git a/test/tc_httpfetcher.rb b/test/tc_httpfetcher.rb
28 index d44b3ee..e904086 100755
29 --- a/test/tc_httpfetcher.rb
30 +++ b/test/tc_httpfetcher.rb
31 @@ -9,7 +9,7 @@ class HttpFetcherTest < Test::Unit::TestCase
32 def test_get_https
33 s = ''
34 assert_nothing_raised do
35 - s = HTTPFetcher::fetch('https://linuxfr.org/pub/', Time::at(0))
36 + s = fetcher.fetch('https://linuxfr.org/pub/', Time::at(0))
37 end
38 assert(s.length > 20)
39 end
40 @@ -21,7 +21,7 @@ class HttpFetcherTest < Test::Unit::TestCase
41 def test_get_httpnotmodif
42 s = 'aaa'
43 assert_nothing_raised do
44 - s = HTTPFetcher::fetch('http://www.lucas-nussbaum.net/feed2imap_tests/notmodified.php', Time::new())
45 + s = fetcher.fetch('http://www.lucas-nussbaum.net/feed2imap_tests/notmodified.php', Time::new())
46 end
47 assert_nil(s)
48 end
49 @@ -29,7 +29,7 @@ class HttpFetcherTest < Test::Unit::TestCase
50 def test_get_redir1
51 s = 'aaa'
52 assert_nothing_raised do
53 - s = HTTPFetcher::fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR}", Time::at(0))
54 + s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR}", Time::at(0))
55 end
56 assert_equal('OK', s)
57 end
58 @@ -37,14 +37,14 @@ class HttpFetcherTest < Test::Unit::TestCase
59 def test_get_redir2
60 s = ''
61 assert_raise(RuntimeError) do
62 - s = HTTPFetcher::fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR + 1}", Time::at(0))
63 + s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR + 1}", Time::at(0))
64 end
65 end
66
67 def test_httpauth
68 s = ''
69 assert_nothing_raised do
70 - s = HTTPFetcher::fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php", Time::at(0))
71 + s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php", Time::at(0))
72 end
73 assert_equal("Login: aaa / Password: bbb \n", s)
74 end
75 @@ -52,7 +52,7 @@ class HttpFetcherTest < Test::Unit::TestCase
76 def test_redirauth
77 s = ''
78 assert_nothing_raised do
79 - s = HTTPFetcher::fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php?redir=1", Time::at(0))
80 + s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php?redir=1", Time::at(0))
81 end
82 assert_equal("Login: aaa / Password: bbb \n", s)
83 end
84 @@ -60,7 +60,13 @@ class HttpFetcherTest < Test::Unit::TestCase
85 def test_notfound
86 s = ''
87 assert_raises(RuntimeError) do
88 - s = HTTPFetcher::fetch("http://ensilinx1.imag.fr/~lucas/notfound.html", Time::at(0))
89 + s = fetcher.fetch("http://ensilinx1.imag.fr/~lucas/notfound.html", Time::at(0))
90 end
91 end
92 +
93 + private
94 +
95 + def fetcher
96 + HTTPFetcher.new
97 + end
98 end
99 --
100 2.1.4
101
00 0001-Fix-usage-of-filters.patch
1 0002-Fix-regression-in-include-images-option.patch