user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 09/13] view: fix up some HTML injection via Message-ID vectors
Date: Thu, 30 Jun 2016 09:21:39 +0000	[thread overview]
Message-ID: <20160630092143.31651-10-e@80x24.org> (raw)
In-Reply-To: <20160630092143.31651-1-e@80x24.org>

Oops, these were only introduced during the hybrid flat thread
view reworking and never deployed.
---
 lib/PublicInbox/View.pm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 17d6de5..44130b9 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -103,7 +103,7 @@ sub index_entry {
 	my $subj = $hdr->header('Subject');
 
 	my $mid_raw = mid_clean(mid_mime($mime));
-	my $id = id_compress($mid_raw);
+	my $id = id_compress($mid_raw, 1);
 	my $id_m = 'm'.$id;
 	my $mid = PublicInbox::Hval->new_msgid($mid_raw);
 
@@ -119,20 +119,23 @@ sub index_entry {
 		my $dst = _hdr_names($hdr, $f);
 		push @tocc, "$f: $dst" if $dst ne '';
 	}
-	my $mapping = $ctx->{mapping};
 	$rv .= "From: "._hdr_names($hdr, 'From').' @ '._msg_date($hdr)." UTC";
 	my $upfx = $ctx->{-upfx};
-	$rv .= qq{ (<a\nhref="$upfx$mid_raw/">permalink</a> / };
-	$rv .= qq{<a\nhref="$upfx$mid_raw/raw">raw</a>)\n};
+	my $mhref = $upfx . $mid->as_href . '/';
+	$rv .= qq{ (<a\nhref="$mhref/">permalink</a> / };
+	$rv .= qq{<a\nhref="$mhref/raw">raw</a>)\n};
 	$rv .= '  '.join('; +', @tocc) . "\n" if @tocc;
+
+	my $mapping = $ctx->{mapping};
 	if (!$mapping && $irt) {
-		$rv .= qq(In-Reply-To: &lt;<a\nhref="$upfx$irt/">$irt</a>&gt;\n)
+		my $mirt = PublicInbox::Hval->msgid($irt);
+		my $href = $upfx . $mirt->as_href . '/';
+		my $html = $mirt->as_html;
+		$rv .= qq(In-Reply-To: &lt;<a\nhref="$href/">$html</a>&gt;\n)
 	}
 	$rv .= "\n";
 
 	# scan through all parts, looking for displayable text
-	my $href = $mid->as_href;
-	my $mhref = $ctx->{-upfx}.$href.'/';
 	msg_iter($mime, sub { $rv .= add_text_body($mhref, $_[0]) });
 
 	# add the footer
-- 
EW


  parent reply	other threads:[~2016-06-30  9:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  9:21 [PATCH 0/13] www: hybrid flat+thread conversation view Eric Wong
2016-06-30  9:21 ` [PATCH 01/13] www: implement " Eric Wong
2016-06-30  9:21 ` [PATCH 02/13] www: use WwwStream for dumping thread and search views Eric Wong
2016-06-30  9:21 ` [PATCH 03/13] view: show thread context in the thread-aware flat view Eric Wong
2016-06-30  9:21 ` [PATCH 04/13] view: merge $state hash with existing $ctx Eric Wong
2016-06-30  9:21 ` [PATCH 05/13] feed: add $INBOX/new.html endpoint Eric Wong
2016-06-30  9:21 ` [PATCH 06/13] view: tweak thread/index header slightly Eric Wong
2016-06-30  9:21 ` [PATCH 07/13] view: show more nearby messages in flat thread view Eric Wong
2016-06-30  9:21 ` [PATCH 08/13] www: reinstate old thread view as an option Eric Wong
2016-06-30  9:21 ` Eric Wong [this message]
2016-06-30 19:03   ` [PATCH 14/13] view: fix permalink and raw links at the top Eric Wong
2016-06-30  9:21 ` [PATCH 10/13] view: default to flat/hybrid thread display Eric Wong
2016-06-30  9:21 ` [PATCH 11/13] view: show thread size when linking to summary Eric Wong
2016-06-30  9:21 ` [PATCH 12/13] view: fixup bad reference to new_msgid Eric Wong
2016-06-30  9:21 ` [PATCH 13/13] www_stream: add response wrapper sub Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160630092143.31651-10-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).