1 # Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
17 > Long and wordy reply goes here and it is split across multiple lines.
18 > We generate links to a separate full page where quoted-text is inline.
22 > See MAX_INLINE_QUOTED
23 > See MAX_INLINE_QUOTED
24 > See MAX_INLINE_QUOTED
25 > See MAX_INLINE_QUOTED
26 > See MAX_INLINE_QUOTED
27 > See MAX_INLINE_QUOTED
28 > See MAX_INLINE_QUOTED
29 > See MAX_INLINE_QUOTED
33 my $s = Email::Simple->create(
35 From => 'a@example.com',
36 To => 'b@example.com',
37 'Content-Type' => 'text/plain',
38 'Message-ID' => '<hello@example.com>',
39 Subject => 'this is a subject',
43 my $mime = Email::MIME->new($s);
44 my $html = PublicInbox::View::msg_html(undef, $mime);
47 like($html, qr!<a\nhref="\.\./raw"!s, "raw link present");
48 like($html, qr/hello world\b/, "body present");
49 like($html, qr/> keep this inline/, "short quoted text is inline");
56 attributes => { content_type => 'text/plain', },
60 attributes => { content_type => 'text/plain', },
64 my $mime = Email::MIME->create(
66 From => 'a@example.com',
68 'Message-ID' => '<blah@example.com>',
69 'In-Reply-To' => '<irp@example.com>',
74 my $html = PublicInbox::View::msg_html(undef, $mime);
75 like($html, qr/hi\n-+ part #2 -+\nbye\n/, "multipart split");
78 # multipart email with attached patch
82 attributes => { content_type => 'text/plain', },
83 body => 'hi, see attached patch',
87 content_type => 'text/plain',
88 filename => "foo.patch",
90 body => "--- a/file\n+++ b/file\n" .
91 "@@ -49, 7 +49,34 @@\n",
94 my $mime = Email::MIME->create(
96 From => 'a@example.com',
97 Subject => '[PATCH] asdf',
98 'Message-ID' => '<patch@example.com>',
103 my $html = PublicInbox::View::msg_html(undef, $mime);
104 like($html, qr!see attached patch\n-+ foo\.patch -+\n--- a/file\n!,
105 "parts split with filename");
108 # multipart collapsed to single quoted-printable text/plain
113 content_type => 'text/plain',
114 encoding => 'quoted-printable',
119 my $mime = Email::MIME->create(
121 From => 'qp@example.com',
123 'Message-ID' => '<qp@example.com>',
128 my $orig = $mime->body_raw;
129 my $html = PublicInbox::View::msg_html(undef, $mime);
130 like($orig, qr/hi =3D bye=/, "our test used QP correctly");
131 like($html, qr/\bhi = bye\b/, "HTML output decoded QP");
135 use PublicInbox::MID qw/id_compress/;
136 like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
137 "percent always converted to sha1 to workaround buggy httpds");
138 is(id_compress('foobar-wtf'), 'foobar-wtf',
139 'regular ID not compressed');