From 9a2931759c3dcbd879728b49151aa3f8a641b506 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 27 Aug 2015 04:34:01 +0000 Subject: wire up to display non-suffixed Message-ID links These URLs are preferable in case somebody decides to get cute and use a suffix we would've used to prevent others from linking to their message. The common /m/$MESSAGE_ID/ URLs are now 4 characters shorter so may fit better on terminals. --- t/cgi.t | 28 ++++++++++++++-------------- t/feed.t | 2 +- t/plack.t | 4 ++-- t/view.t | 7 ++++--- 4 files changed, 21 insertions(+), 20 deletions(-) (limited to 't') diff --git a/t/cgi.t b/t/cgi.t index 020dfe7e..fc28ae30 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -152,27 +152,27 @@ EOF } local $ENV{GIT_DIR} = $maindir; - my $res = cgi_run("/test/m/slashy%2fasdf%40example.com.txt"); + my $res = cgi_run("/test/m/slashy%2fasdf%40example.com/raw"); like($res->{body}, qr/Message-Id: <\Q$slashy_mid\E>/, - "slashy mid.txt hit"); + "slashy mid raw hit"); - $res = cgi_run("/test/m/blahblah\@example.com.txt"); + $res = cgi_run("/test/m/blahblah\@example.com/raw"); like($res->{body}, qr/Message-Id: /, - "mid.txt hit"); - $res = cgi_run("/test/m/blahblah\@example.con.txt"); - like($res->{head}, qr/Status: 404 Not Found/, "mid.txt miss"); + "mid raw hit"); + $res = cgi_run("/test/m/blahblah\@example.con/raw"); + like($res->{head}, qr/Status: 404 Not Found/, "mid raw miss"); - $res = cgi_run("/test/m/blahblah\@example.com.html"); - like($res->{body}, qr/\A/, "mid.html hit"); + $res = cgi_run("/test/m/blahblah\@example.com/"); + like($res->{body}, qr/\A/, "mid html hit"); like($res->{head}, qr/Status: 200 OK/, "200 response"); - $res = cgi_run("/test/m/blahblah\@example.con.html"); - like($res->{head}, qr/Status: 404 Not Found/, "mid.html miss"); + $res = cgi_run("/test/m/blahblah\@example.con/"); + like($res->{head}, qr/Status: 404 Not Found/, "mid html miss"); - $res = cgi_run("/test/f/blahblah\@example.com.html"); - like($res->{body}, qr/\A/, "mid.html hit"); + $res = cgi_run("/test/f/blahblah\@example.com/"); + like($res->{body}, qr/\A/, "mid html"); like($res->{head}, qr/Status: 200 OK/, "200 response"); - $res = cgi_run("/test/f/blahblah\@example.con.html"); - like($res->{head}, qr/Status: 404 Not Found/, "mid.html miss"); + $res = cgi_run("/test/f/blahblah\@example.con/"); + like($res->{head}, qr/Status: 404 Not Found/, "mid html miss"); $res = cgi_run("/test/"); like($res->{body}, qr/slashy%2Fasdf%40example\.com/, diff --git a/t/feed.t b/t/feed.t index 6102e8a7..a9955f08 100644 --- a/t/feed.t +++ b/t/feed.t @@ -77,7 +77,7 @@ EOF } unlike($feed, qr/drop me/, "long quoted text dropped"); - like($feed, qr!/f/\d%40example\.com\.html\b!, + like($feed, qr!/f/\d%40example\.com/#q!, "/f/ url generated for long quoted text"); like($feed, qr/inline me here/, "short quoted text kept"); like($feed, qr/keep me/, "unquoted text saved"); diff --git a/t/plack.t b/t/plack.t index ed41ab17..ee77291c 100644 --- a/t/plack.t +++ b/t/plack.t @@ -88,7 +88,7 @@ EOF is(200, $res->code, 'success response received'); like($res->content, qr!href="\Q$atomurl\E"!, 'atom URL generated'); - like($res->content, qr!href="m/blah%40example\.com\.html"!, + like($res->content, qr!href="m/blah%40example\.com/"!, 'index generated'); }); @@ -98,7 +98,7 @@ EOF my $res = $cb->(GET($pfx . '/atom.xml')); is(200, $res->code, 'success response received for atom'); like($res->content, - qr!link\s+href="\Q$pfx\E/m/blah%40example\.com\.html"!s, + qr!link\s+href="\Q$pfx\E/m/blah%40example\.com/"!s, 'atom feed generated correct URL'); }); diff --git a/t/view.t b/t/view.t index 151fa77f..77cf3a32 100644 --- a/t/view.t +++ b/t/view.t @@ -44,17 +44,18 @@ EOF my $html = PublicInbox::View::msg_html(undef, $mime); # ghetto tests - like($html, qr!]+><\/a>> Long and wordy/, "long quoted text is anchored"); # short page - my $pfx = "http://example.com/test/f"; + my $pfx = "../../f/hello%40example.com/"; $mime = Email::MIME->new($s); my $short = PublicInbox::View::msg_html(undef, $mime, $pfx); - like($short, qr!