From: Eric Wong Date: Sun, 17 Jul 2016 23:27:02 +0000 (+0000) Subject: extmsg: favor user-provided URL on partial matches X-Git-Tag: v1.0.0~275 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=8888a03c12dcd0f17ff611f4617523942a3aed49 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. --- 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;