user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] extmsg: favor user-provided URL on partial matches
@ 2016-07-17 23:28 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-07-17 23:28 UTC (permalink / raw)
  To: meta

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 2a9316b..955ada7 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;
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-17 23:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-17 23:28 [PATCH] extmsg: favor user-provided URL on partial matches Eric Wong

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).