From 8888a03c12dcd0f17ff611f4617523942a3aed49 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 Jul 2016 23:27:02 +0000 Subject: [PATCH] extmsg: favor user-provided URL on partial matches While an inbox may have multiple URLs, we will favor the existing URL for the current inbox on partial matches to avoid confusing users or slowing them down by requiring a new TCP connection. --- lib/PublicInbox/ExtMsg.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 2a9316b1..955ada7e 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -108,9 +108,11 @@ again: $code = 300; my $es = $n_partial == 1 ? '' : 'es'; $s .= "\n$n_partial partial match$es found:\n\n"; + my $cur_name = $cur->{name}; foreach my $pair (@partial) { my ($ibx, $res) = @$pair; - my $u = $ibx->base_url or next; + my $env = $ctx->{env} if $ibx->{name} eq $cur_name; + my $u = $ibx->base_url($env) or next; foreach my $m (@$res) { my $p = PublicInbox::Hval->new_msgid($m); my $r = $p->as_href; -- 2.44.0